Skip to content

Release Testing Instructions WooCommerce 5.2

Greg edited this page Mar 25, 2021 · 22 revisions

WooCommerce 5.2 includes:

WooCommerce Admin Updates:

2.1.3

Fix a bug where the JetPack connection flow would not activate #6521

  1. With a fresh install of wc-admin and woocommerce, go to the home screen
  2. Going to the homescreen redirects to the profile setup wizard
  3. The first step is "Store details" choose United States (any state) for country and fill in the other details with test data.
  4. Click "continue", you should be taken to the "Industry" step.
  5. In the "Industry" step check the "Food and Drink" option only. Click "continue"
  6. In the "Product Type" step choose any value and click "continue"
  7. You should arrive at the "Business details" step which provides 2 tabs: "Business details" and "Free features". In the "Business Details" tab fill out the dropdowns with any values. Click "continue".
  8. In the "Free features" step expand the list of extensions to install by clicking the arrow to the right of "Add recommended business features to my site".
  9. Uncheck all the extensions except for "Enhance speed and security with Jetpack"
  10. Click "continue", the plugin will be installed and you should arrive at the theme step.
  11. Click "Continue with my active theme"
  12. After finishing the wizard, this should redirect you to the "Jetpack" setup connection flow. (You should not be redirected straight to the homescreen).

Update target audience of business feature step #6508

Scenario #1

  1. With a fresh install of wc-admin and woocommerce, go to the home screen, which starts the onboarding wizard
  2. Fill out the store details with a canadian address (addr: 4428 Blanshard, country/region: Canada -- British Columbia, city: Victoria, postcode: V8W 2H9)
  3. Click continue and select Fashion, apparel, and accessories, continue, and select Physical products, and continue.
  4. The business details tab should show a Business details tab, and a Free features tab (disabled at first)
    • There should only be dropdowns visible on the Business details step (no checkboxes)
  5. Select 1-10 for the first dropdown, and No for the second, and click Continue.
  6. Click on the expansion icon for the Add recommended business features to my site
  7. It should list 7 features, including WooCommerce Payments (top one)
    • Note down the selected features, for step 10
  8. Click continue, and select your theme, after it should redirect to the home screen (showing the welcome modal, you can step through this).
  9. The home screen task list should include a Set up WooCommerce Payments task, and there should also be a Set up additional payment providers inbox card displayed (below the task list).
  10. Go to Plugins > installed Plugins, check if the selected plugin features selected in step 7 are installed and activated.

Scenario #2

  1. With a fresh install of wc-admin and woocommerce, go to the home screen, which starts the onboarding wizard
  2. Fill out the store details with a spanish address (addr: C/ Benito Guinea 52, country/region: Spain -- Barcelona, city: Canet de Mar, postcode: 08360)
  3. Click continue and select Fashion, apparel, and accessories, continue, and select Physical products, and continue.
  4. On the business details tab select 1-10 for the first dropdown, and No for the second.
    • After filling the dropdowns it should show several checkboxes with plugins (Facebook, mailchimp, creative mail, google ads)
    • Note which ones you kept selected (you can unselect one or two)
  5. Click continue, and select your theme, it should show the WooCommerce Shipping & Tax step after, you can click No thanks.
  6. You will be redirected to the home screen, showing the welcome modal, you can step through this.
  7. The task list should show the Choose payment methods task, and the Set up additional payment providers inbox card should not be present.
  8. Click on the Choose payment methods task, it should not be displaying the Woocommerce Payments option.
  9. Go to Plugins > installed Plugins, check if the selected plugin features selected in step 4 are installed and activated.

2.1.2

Add Guards to "Deactivate Plugin" Note Handlers #6532

Test incompatible WooCommerce version
  • Install and activate Woocommerce 4.7
  • See that the Woocommerce Admin plugin is deactivated.
  • Add the Deactivate Plugin note via SQL.
INSERT INTO `wp_wc_admin_notes` (`name`, `type`, `locale`, `title`, `content`, `content_data`, `status`, `source`, `date_created`, `date_reminder`, `is_snoozable`, `layout`, `image`, `is_deleted`, `icon`) VALUES ( 'wc-admin-deactivate-plugin', 'info', 'en_US', 'Deactivate old WooCommerce Admin version', 'Your current version of WooCommerce Admin is outdated and a newer version is included with WooCommerce.  We recommend deactivating the plugin and using the stable version included with WooCommerce.', '{}', 'unactioned', 'woocommerce-admin', '2021-03-08 01:26:44', NULL, 0, 'plain', '', 0, 'info');
  • See that the note is in the inbox
  • Activate the Woocommerce Admin plugin.
  • See that Woocommerce Admin immediately de-activates without a fatal error.
  • See that the note remains in inbox
Test compatible WooCommerce version
  • Deactivate the Woocommerce Admin plugin.
  • Install and activate the latest Woocommerce version.
  • Add the Deactivate Plugin note via SQL.
INSERT INTO `wp_wc_admin_notes` (`name`, `type`, `locale`, `title`, `content`, `content_data`, `status`, `source`, `date_created`, `date_reminder`, `is_snoozable`, `layout`, `image`, `is_deleted`, `icon`) VALUES ( 'wc-admin-deactivate-plugin', 'info', 'en_US', 'Deactivate old WooCommerce Admin version', 'Your current version of WooCommerce Admin is outdated and a newer version is included with WooCommerce.  We recommend deactivating the plugin and using the stable version included with WooCommerce.', '{}', 'unactioned', 'woocommerce-admin', '2021-03-08 01:26:44', NULL, 0, 'plain', '', 0, 'info');
  • Activate the Woocommerce Admin plugin.
  • See that note is not in the inbox
  • Add the Deactivate Plugin note via SQL.
INSERT INTO `wp_wc_admin_notes` (`name`, `type`, `locale`, `title`, `content`, `content_data`, `status`, `source`, `date_created`, `date_reminder`, `is_snoozable`, `layout`, `image`, `is_deleted`, `icon`) VALUES ( 'wc-admin-deactivate-plugin', 'info', 'en_US', 'Deactivate old WooCommerce Admin version', 'Your current version of WooCommerce Admin is outdated and a newer version is included with WooCommerce.  We recommend deactivating the plugin and using the stable version included with WooCommerce.', '{}', 'unactioned', 'woocommerce-admin', '2021-03-08 01:26:44', NULL, 0, 'plain', '', 0, 'info');
  • De-activate the Woocommerce Admin plugin.
  • See that note is not in the inbox

2.1.0

Correct the Klarna slug #6440

  1. Set up a new store with a UK address so that Klarna available as a payment processor
  2. Go to the "Choose payment methods" task item
  3. Set up Klarna. The plugin will install.
  4. Click Continue. It should take you back to the payment methods page - previously it wasn't doing anything but a console error was displayed.

Navigation: Reset submenu before making Flyout #6396

  • Download and activate the MailChimp plugin.
  • Turn on Navigation at Settings > Advanced > Features
  • Return to the WP dashboard
  • Hover over WooCommerce and see the flyout menu appear
  • MailChimp should not be included.

Email notes now are turned off by default #6324

  • Upload the plugin and activate it.
  • Update the installation date (we need a 10-day old store). You can do it with an SQL statement like this (using the WP phpMyAdmin plugin):
UPDATE `wp_options` SET `option_value`=UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 10 day)) WHERE `option_name` = 'woocommerce_admin_install_timestamp';
  • Confirm that woocommerce_merchant_email_notifications was not set before by core with a SQL statement like:
DELETE FROM `wp_options` WHERE `wp_options`.`option_name` = 'woocommerce_merchant_email_notifications';

or with wp-cli:

wp option delete 'woocommerce_merchant_email_notifications';
  • Run the cron job wc_admin_daily (this tool can help WP Crontrol).
    • Go to Tools > Cron Events and scroll down to the wc_admin_daily.
    • Hover over the item and click Edit change the Next Run to Now and click Update Event.
    • It will redirect you to the cron event list, and wc_admin_daily should be near the top, if you wait 10 seconds and refresh the page the wc_admin_daily should be near the bottom again, this means it has been run, and scheduled again to run tomorrow.
  • You should have not received an email note.
  • Verify the note wc-admin-add-first-product-note was added in the DB and its status is unactioned. You can use a statement like this:
SELECT `status` FROM `wp_wc_admin_notes` WHERE `name` = 'wc-admin-add-first-product-note';

or with wp-cli:

wp db query 'SELECT status FROM wp_wc_admin_notes WHERE name = "wc-admin-add-first-product-note"' --skip-column-names
  • Run the cron again.
  • The note's status should continue being unactioned.

Refactor menu item mapping and sorting #6382

  1. Enable the new navigation under WooCommerce -> Settings -> Advanced -> Features.
  2. Navigate to a WooCommerce page.
  3. Make sure all items and categories continue to work as expected.
  4. Activate multiple extensions that register WooCommerce extension categories. (e.g., WooCommerce Bookings and WooCommerce Payments).
  5. Favorite and unfavorite menu items.
  6. Make sure the menu item order is correct after unfavoriting.
  7. Create a user with permissions to see some but not all registered WooCommerce pages.
  8. Check that a user without permission to access a menu item cannot see said menu item.

Fixed associated Order Number for refunds #6428

  1. Prepare a store with refunded orders.
  2. Go to Analytics > Orders
  3. Set the Date Range filter in order to cover the refunded order date.
  4. Verify that now the associated order number and the related products are visible.

Remove CES actions for adding and editing a product and editing an order #6355

  1. Add a product. The customer effort score survey should not appear (this is the toast message at the bottom left of the page).
  2. Edit a product. The customer effort score survey should not appear.
  3. Edit an order. The customer effort score survey should not appear.

Center the activity panel #6289

  1. Narrow your screen to <782px
  2. Go to WooCommerce home and orders page
  3. Click on 'w' button, see that the activity panel renders as expected.

Make sure that industry is defined in payment methods #6281

  • Start a new store, and skip the initial onboarding flow, there is a button Skip store details at the bottom
  • Load the Set up payments task, the payment options should load correctly.

Add a new note with a link to the downloadable product doc #6277

  1. Make sure your store does not have any download products.
  2. Install WP Crontrol plugin.
  3. Add a new download product.
  4. Navigate to Tools -> Cron Events and run wc_admin_daily
  5. Navigate to WooCommerce -> Home and confirm that the note has been added.

Onboarding - Fixed "Business Details" error #6271

  • Go to the "Industry" step in the Onboarding Wizard and select Food and drink.
  • Go to the "Business Details" step and press Free features.
  • Press Continue.
  • It should work.
  • Try also selecting and unselecting some checkboxes before pressing Continue.

Change siteUrl to homeUrl on navigation site title #6240

  • Go to WP settings and set the home page to My account
  • Go to WC settings and use the new navigation feature
  • Click on the header site title My Site and see that the page direct to My account

Refactor panel with withFocusOutside #6233

  • Go to WooCommerce home page
  • Click on Display and Help button back and forth, check that the popover and the panel close as expected.
  • Check that the setup store tab continues to work.

Move capability checks to client #6365

  1. Create various non-admin users with custom capabilities. Make sure to not include the view_woocommerce_reports for at least one role. https://wordpress.org/plugins/leira-roles/
  2. Log in as the non-admin users.
  3. Check that the correct menu items are shown.
  4. Check that there aren't items shown to the user they should not be able to use or interact with.
  5. Enable the new navigation under WooCommerce -> Settings -> Advanced -> Features.
  6. Check that the users are able to see the new navigation menu.
  7. Click on various tabs in the activity panel.
  8. Make sure the tabs work as expected.
  9. Make sure that users without the manage_woocommerce permission are not able to see the "Store Setup" tab.
  10. With a user that can manage_woocommerce, navigate to the homepage via URL and make sure the homescreen is shown. /wp-admin/admin.php?page=wc-admin
  11. With a user that cannot view_woocommerce_reports make sure navigating to an analytics report does not work. /wp-admin/admin.php?page=wc-admin&path=/analytics/overview

Add CES track settings tab on updating settings #6368

  • Make sure tracking is enabled in settings:
/wp-admin/admin.php?page=wc-settings&tab=advanced&section=woocommerce_com
  • Delete the option woocommerce_ces_shown_for_actions to make sure CES prompt triggers when updating settings.
  • Enable the logging of Tracks events to your browser dev console:
localStorage.setItem( 'debug', 'wc-admin:tracks' );
  • Go to WooCommerce > Settings, and select a top-level tab such as Products, Shipping, etc.
  • Click on Save changes.
  • Observe in developer console, wcadmin_ces_snackbar_view is logged when CES prompt is displayed.
  • In the event props, it should have a new settings_area key followed by the value of the settings tab you have selected.

Add navigation intro modal #6367

  1. Visit the homescreen and dismiss the original welcome modal if you haven't already.
  2. Enable the new navigation under WooCommerce -> Settings -> Advanced -> Features. (This will also require opting into tracking).
  3. Visit the WooCommerce Admin homescreen.
  4. Note the new modal.
  5. Check that pagination works as expected and modal styling is as expected.
  6. Dismiss the modal.
  7. Refresh the page to verify the modal does not reappear.
  8. On a new site, enable the navigation before visiting the homescreen.
  9. Navigate to the homescreen.
  10. Note the welcome modal is shown and the navigation intro modal is not shown.
  11. Refresh the page and note the nav intro modal was dismissed and never shown.

WooCommerce Product Blocks Updates:

When using the testing instructions below, test only those cases presented in the section called "Feature plugin and package inclusion in WooCommerce core". There is no need to test cases in the "Feature plugin only" section since they are not a part of WooCommerce Core.

Blocks 4.6.0

Blocks 4.7.0

WooCommerce Core Updates:

Fix offsets not calculated correctly sometimes on select2 dropdowns (29397)

  1. Install/activate jQuery Migrate Plugin so you can easily switch the two different jQuery versions for testing.
  2. Add an attributes filter widget to your shop. Use Dropdown as display type.
  3. Go to the shop page and click on the Select2 dropdown and ensure the dropdown shows correctly aligned and that you can select any of the attributes listed. Select an attribute and let page reload.
  4. Click on the dropdown again and ensure it expands correctly and you are able to select other attributes as well.
  5. Do the same test with and without the admin toolbar visible. You can change this in your user settings.
  6. Also do the same tests (3 to 6) with the dropdown going upwards when not enough room to show on the bottom.
  7. Now do the same tests again (3 to 6) with using older jQuery version by changing the settings in jQuery Migrate plugin. Ensure all is looking nice.
  8. Also check that the dropdown is showing nicely in checkout page (country selection).

Low stock threshold for variations(29345)

  1. Create a variation product (P1) with at least 3 variations, set 2 variations to manage stock, one not to. Parent product set to NOT manage stock.
  2. Create a variation product (P2) with at least 3 variations, set 2 variations to manage stock, one not to. Parent product set to manage stock.
  3. Configure the store-wide low stock setting (or leave to the default 2) under WooCommerce > Settings > Products > Inventory.
  4. Set the P1.V1 low stock amount to X (different to store-wide setting A), leave the P1.V2 low stock amount to no value (so that it takes the default value from store-wide setting). Set the same for P2 variations, while also setting the product P2's low stock amount to value Z.
  5. Set the stock above the limits for these products.
  6. Submit orders for the different variations and see if you observe expected behavior.
  7. Check that the emails are being sent at the correct stock level for each variation.
  8. Export both products, import them back as new products and confirm that the low stock amounts are set correctly.
  9. Try to set the low stock amount for all variations via the Bulk Actions dropdown.

Trigger country field change on address change click (29282)

  1. Add a product to the cart.
  2. Click Calculate shipping under Cart totals on the Cart page.
  3. Change country to Bahamas. ( This will hide the postcode field )
  4. Click Update
  5. Click on Change address and see that the postcode field does not render.

Fix: Product categories widget item count not always showing the correct number (29281)

  1. Add the Product Categories widget to your site. Enable show counts option.
  2. Make sure to have a hand full of products that belong to a category that is listed in that widget.
  3. For couple of the products, set the stock level to out of stock and save the product.
  4. Go back to the frontend shop page and ensure the widget shows the product count correctly.
  5. Go to your woocommerce->settings->products->inventory and set Hide out of stock items from the catalog to enabled.
  6. Go back to the frontend shop page and ensure the widget shows the product count correctly. Should show less than in step 5 as now it suppose to hide the product from catalog if it is out of stock.
  7. Disable Hide out of stock items from the catalog setting and save.
  8. Go back to the frontend shop page and ensure the widget shows the product count correctly.
  9. Test the added filter by using the code snippet add_filter( 'woocommerce_product_recount_terms', '__return_false' );.
  10. Test steps 1 to 8 and observe that the count is no longer refreshed because the filter prevents the recount.

Prevent displaying coupon form on checkout requiring login (29151)

  1. While logged in, add a product to your cart.
  2. Go to WooCommerce > Settings > Accounts and Privacy.
  3. Change your settings to match these https://d.pr/i/cvTYw2
    • Disable Allow customers to place orders without an account
    • Disable Allow customers to create an account during checkout
  4. Log out (or open your store in a new/private browser).
  5. Add a product to your cart.
  6. Go to the checkout page and note the coupon notice isn't displayed. https://d.pr/i/wnfrD8

Add/28568 dashboard widget - setup (29174)

  1. Start with a fresh installation of WooCoommerce and don't start onboarding wizard yet.
  2. Navigate to WordPress Dashboard and confirm that you see a new widget with the title "WooCommerce Setup", but "WooCommece Status" widget is hidden.
  3. Confirm that the widget shows "Step 0 of 5" (the total # of steps can be 6 if you have a payment plugin available)
  4. Start working on onboarding tasks one by one.
  5. As you finish onboarding tasks, check back and confirm that step # increases.
  6. The "WooCommerce Setup" widget should not be displayed once you complete the onboarding tasks, but "WooCommerce Status" widget should be displayed again.

Avoid/minimize wc-ajax requests when geolocation_ajax is enabled (29182)

Begin by setting the Default Customer Address to "Geolocation (with Page Caching Support)" under WooCommerce > Settings > General

Start by checking out the problem:

  1. Set your test environment to the current version of WooCommerce (5.1)
  2. Open your browser's network tab, observe that with each new page load (while you move around the storefront), there is an extra wc-ajax=get_customer_location request.
  3. Enter the cart and checkout pages, notice that the wc-ajax=get_customer_location requests don't happen on these pages.

Next:

  1. Checkout this branch.
  2. Repeat the above test; notice that the number of wc-ajax=get_customer_location requests has been reduced.
  3. Add one or more items and navigate to checkout (but, no need to actually checkout).
  4. Change your billing country and then keep on shopping without checking out.
  5. Observe that the value of the ?v= query var has changed accordingly.

🎥 Screencasts

  • Current behaviour → pay attention to the large number of wc-ajax=get_customer_location requests.
  • Revised behaviour → (also shared above) notice the number of wc-ajax=get_customer_location requests is massively reduced, but that the ?v= query var still 'updates' if the billing country changes.

Remove compatibility checks for major version (29200)

  1. Start with WC 5.2 beta
  2. Install a plugin that triggers the old warning (such as woocommerce-gateway-amazon-payments-advanced.1.12.2__1_.zip)
  3. WP Admin: Go to Plugins
  4. With 5.2 beta, you should see an active link saying “Enable auto-updates” on the line with WooCommerce, to the right
  5. WP Admin: Go to Plugins > Plugin Editor
  6. Select WooCommerce in the top right corner dropdown, click Select, it should show the source of woocommerce.php
  7. Change line 6 from * Version: 5.2.0-dev to * Version: 4.9.0, click on Update File at the bottom
  8. Switch to next file:
  9. Click on includes on the right in the column with file names, under includes, find class-woocommerce.php and click on it
  10. On line 26 update public $version = '5.2.0'; to public $version = '4.9.0'; , click on Update File
  11. Go to /wp-admin/update-core.php, select WooCommerce in the list of plugins and hit update, no more warnings should stop you from updating. WC will update to the latest version (5.1, as of now)

The checkpoints being steps 4 and 11: step 4: enable auto-updates is an active link, not greyed out step 11: no warning is displayed

Screenshot 2021-02-23 at 13 22 08

Validate variation ID while adding products to the cart (29208)

Note for this test you will need to get the variable product ID. To get this ID:

  • Open a variable product
  • In the Product data section, click on "Variations"
  • In the list, note the numbers (in this screenshot, there's 33, 26, 27, 28). These numbers are the VARIABLE_PRODUCT_ID

  1. Try add to a product to the cart with ?add-to-cart=VARIABLE_PRODUCT_ID&variation_id=VARIABLE_PRODUCT_ID so the URL should look something like https://mystore.com/?add-to-cart=10&variation_id=33
  2. Now try ?add-to-cart=VARIABLE_PRODUCT_ID&variation_id=PRODUCT_ID
  3. And finally ?add-to-cart=VARIABLE_PRODUCT_ID&variation_id=VARIATION_ID_FROM_ANOTHER_VARIABLE_PRODUCT
  4. Apply this patch and try all steps again.

Woocommerce dashboard status widget net sales link and logic (29149)

  1. Navigate to the WP dashboard (Dashboard > Home) and scroll down to the WooCommerce Status widget
  2. Click on the first row (net sales this month), it should redirect to wp-admin/admin.php?page=wc-admin&path=%2Fanalytics%2Frevenue&chart=net_revenue&orderby=net_revenue&period=month&compare=previous_period
  3. Now add a product and a completed order with the product
  4. Make sure all the actions are completed in WooCommerce > Status > Scheduled Actions
  5. Go back to the dashboard WooCommerce status widget. The net sales should now show an updated number, and the little spark line on the right should match accordingly (have at-least one spike of the completed order).
  6. Click on the link again, and see if the displayed amount matches that of the Analytics > Revenue screen.
  7. Go back to the dashboard a second line should be present with the top performing product
  8. Click on the top seller product name, it should redirect to wp-admin/admin.php?page=wc-admin&filter=single_product&products=PRODUCT_ID&path=%2Fanalytics%2Fproducts where the product is selected under the show dropdown.
  9. Add add_filter( 'woocommerce_admin_disabled', '__return_true' ); to your themes functions.php file.
  10. Load the WP dashboard again
  11. The above buttons should now be directing to the old WooCommerce > Reports screen, it should still show the correct number in the widget.

Prevent local relative downloadable products to be treated as "absolute" (28699)

  1. Create a downloadable product, add files that refer to:

For example, you can use paths to files that exist on the server for the WordPress and WooCommerce install, as shown in the screenshot below:

Depending on the server install, these can generally be found in the public or public_html directory where WordPress is installed.

  1. Try to download all the files again. All should work, except for local file download via 3 slashes.

Checkout: phone number validation fix (27242)

  1. Add product to cart
  2. Go to checkout
  3. Fill an invalid phone number, for example insert: a123
  4. Submit
  5. The phone input is marked as invalid (red border)

Fix invalid refund amount error when no decimals (27277)

  1. Go to WooCommerce Settings, set Number of Decimals to 0;
  2. Refund an order by setting the quantity to a number > 0 and the refund amount to 0;
  3. Shouldn't see a browser alert message "Invalid refund amount".

Only add '(optional)' to the billing_address_2 placeholder (29136)

  1. Switch your test environment to the current WooCommerce version (5.1)
  2. Visit the checkout page and inspect the markup for Billing Address 2 field.
  3. Notice that (optional) is repeated (as part of the label text, and again within a span).
  4. Switch to WooCommerce 5.2 beta
  5. Confirm that:
    • The extra (optional) is removed from the label.
    • That the placeholder text still has (optional) at the end.
    • That the label remains hidden.

WooCommerce API Updates:

Low stock threshold for variations(29345)

  1. Create a variation product (P1) with at least 3 variations, set 2 variations to manage stock, one not to. Parent product set to NOT manage stock.
  2. Create a variation product (P2) with at least 3 variations, set 2 variations to manage stock, one not to. Parent product set to manage stock.
  3. Set the P1.V1 low stock amount to X (different to store-wide setting A), leave the P1.V2 low stock amount to no value (so that it takes the default value from store-wide setting). Set the same for P2 variations, while also setting the product P2's low stock amount to value Z.
  4. Set the stock above the limits for these products.
  5. Check the REST API response for v2 GET requests http://one.wordpress.test/wp-json/wc/v2/products/P1/ and http://one.wordpress.test/wp-json/wc/v2/products/P1/variations/V1 to check there are no changes.
  6. Check the REST API response for v3 GET requests http://one.wordpress.test/wp-json/wc/v3/products/P1/ and http://one.wordpress.test/wp-json/wc/v3/products/P1/variations/V1 and check if the correct responses get returned, including new data.
  7. Try to update the product and variation low stock amounts using a POST request with request body such as { "low_stock_amount": 7 }

Fix for issue #27553 - REST API v3 not supporting settings type order and class for settings type on shipping zone methods (29218)

  1. From a fresh wp install, install WooCommerce
  2. Create a REST API consumer key and secret
  3. Add a shipping zone
  4. Add a flat rate shipping method under the newly added zone
  5. Add at least one shipping class
  6. Use the REST API v3 GET endpoint for shipping method zones to retrieve and check the current values (wp-json/wc/v3/shipping/zones/*/method/*).
  7. Use the REST API v3 PUT endpoint for shipping method zones to update the current values (wp-json/wc/v3/shipping/zones/*/method/*) using payload: { "settings": { "type": "order" } }. Supports type with value order or class
  8. Use the same retrieve endpoint from step 6 to verify the changes.

Make the refunds creation REST API behave more as documented (29099)

  1. Temporarily add this at the ned of your woocommerce.php file, this way you won't have to bother about REST API authentication:
add_filter('woocommerce_rest_check_permissions', function() {return true;}, 10, 0 );

(note that this will cause a bunch of unit tests to fail)

  1. As a shopper or in the admin area create an order for two different products, with at least two units of each. Make sure to include taxes and shipping costs.

  2. Get the line items and taxes ids for the order. The easiest way is to run this in the console:

curl localhost/wp-json/wc/v3/orders/<order number> | jq --sort-keys .

(The jq part is optional, it will just pretty-print the json; install with apt-get install jq)

Take note of the line item ids (line_items, shipping_lines) and the tax ids from the received json:

{
"line_items": [
    {
      "id": 111,
      "taxes": [
        {
          "id": 222,
        }
      ]
    }
  ],
"shipping_lines": [
    {
      "id": 333,
      "taxes": [
        {
          "id": 444,
        }
      ]
    }
  ]
}
  1. Run the following to create a refund for one unit of each item, for a value of 1 on each case, including 1 for each tax (adjust the line item and tax ids as appropriate):
curl -X POST localhost/wp-json/wc/v3/orders/<order id>/refunds \
    -H "Content-Type: application/json" \
    -d '{
"api_refund": false,
"reason": "test",
"line_items": [
{
    "id": "<line item 1 id>",
    "quantity": 1,
    "refund_total": 1,
    "refund_tax": [
         {
        "id": "<tax of line item 1 id>",
        "refund_total": 1
        }  
    ]
},
{
    "id": "<line item 2 id>",
    "quantity": 1,
    "refund_total": 1,
    "refund_tax": [
         {
        "id": "<tax of line item 2 id>",
        "refund_total": 1
         }  
    ]
},
{
    "id": "<shipping line item id>",
    "quantity": 0,
    "refund_total": 1,
    "refund_tax": [
         {
        "id": "<tax of shipping line item id>",
        "refund_total": 1
        }  
    ]
}
]}'
  1. Verify that the response is a json with information about the newly created refund. Load the order in admin and verify that each line item got a refund of 1 item for a value of 1, and that each tax got a refund for a value of 1 as well; also verify that the total refunded amount is correct (if you had two line items, both with taxes, and the shipping had taxes too, the total amount refunded should be 6).

Throw an error if a coupon item ID (readonly) is specified during an order update (29146)

To see the problem using the latest production code (5.0) first of all:

  1. Generate an order with a coupon applied.
  2. Via a PUT request, try updating the order and apply another (or the same) coupon—be sure to include an id field for each coupon in the coupon_lines array.
  3. Notice a 200 OK response comes back but that all coupons have been removed (unexpected!) 😬

Using this changeset:

  1. Repeat the above.
  2. Notice the response is a 400 Bad Request and that the order itself is unchanged (much clearer!) 🙂
Clone this wiki locally