Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle backwards compatibility for old HPOS compatibility format #719

Merged
merged 4 commits into from
Oct 10, 2024

Conversation

agibson-godaddy
Copy link
Contributor

@agibson-godaddy agibson-godaddy commented Oct 8, 2024

Summary

This adds backwards compatibility for the old HPOS compatibility format. If the old format is detected, it's converted to the new one.

Story: https://godaddy-corp.atlassian.net/browse/MWC-17548

Details

Additional details to expand on the summary, if needed

QA

Setup

You should see a notice like this:

image

Steps

  1. In CoGs, update the SV Framework to use this branch. You will also have to update the namespaces.
  2. In the woocommerce-cost-of-goods.php file, edit the init_plugin() method like so:
	public function init_plugin() {

		if ( ! $this->plugins_compatible() ) {
			return;
		}

+		require_once plugin_dir_path(__FILE__) . '/vendor/autoload.php';

		$this->load_framework();

		// load the main plugin class
		require_once( plugin_dir_path( __FILE__ ) . 'class-wc-cog.php' );

		// fire it up!
		wc_cog();
	}
  1. Refresh wp-admin
    • The notice is no longer appearing

image

Before merge

  • I have confirmed these changes in each supported minor WooCommerce version

@agibson-godaddy agibson-godaddy self-assigned this Oct 8, 2024
@agibson-godaddy agibson-godaddy marked this pull request as ready for review October 8, 2024 12:01
Comment on lines 195 to 201
if (
array_key_exists('supports_hpos', $args) &&
! isset($args['supported_features']['hpos'])
) {
$args['supported_features']['hpos'] = $args['supports_hpos'];
unset($args['supports_hpos']);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we unset the supports_hpos anyways without checking if supported_features.hpos is set? As well as making sure supported_features key is initialized

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aka f3c9a7e

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @nmolham-godaddy ! Thank you!

@nmolham-godaddy nmolham-godaddy merged commit fd86525 into master Oct 10, 2024
5 checks passed
@nmolham-godaddy nmolham-godaddy deleted the mwc-17548 branch October 10, 2024 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants