Sync the category lookup table when a new category gets created (https://github.com/woocommerce/woocommerce-admin/pull/7290)

* Sync category lookup table when a new category gets created
This commit is contained in:
Moon 2021-07-08 10:39:12 -07:00 committed by GitHub
parent b4cb82b9cb
commit 001779a40d
3 changed files with 21 additions and 0 deletions

View File

@ -24,6 +24,15 @@
3. Click "Dismiss" on a note. Confirm the position of the popover is correct. 3. Click "Dismiss" on a note. Confirm the position of the popover is correct.
4. Click anywhere outside of the popover content and confirm the popover is closed. 4. Click anywhere outside of the popover content and confirm the popover is closed.
### Sync the category lookup table when a new category gets created #7290
1. Navigate to Products -> Add New
2. Add a new category on the Add New page and assign the product to it.
3. Place an order with the product
4. Navigate to Analytics -> Categories
5. You should see the category.
>>>>>>> cdc813055 (Add changelog)
### Use saved values if available when switching tabs #7226 ### Use saved values if available when switching tabs #7226
1. Start onboarding wizard and continue to step 4. 1. Start onboarding wizard and continue to step 4.

View File

@ -108,6 +108,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
- Fix: Fix and refactor explat polling to use setTimeout #7274 - Fix: Fix and refactor explat polling to use setTimeout #7274
- Fix: Cache product/variation revenue query results. #7067 - Fix: Cache product/variation revenue query results. #7067
- Fix: Transient overlapping adjacent content. #7302 - Fix: Transient overlapping adjacent content. #7302
- Sync the category lookup table when a new category gets created #7290
- Tweak: Remove performance indicators when Analytics Flag disabled #7234 - Tweak: Remove performance indicators when Analytics Flag disabled #7234
- Fix: Fix missing translation strings for CES #7270 - Fix: Fix missing translation strings for CES #7270
- Fix: Add missing translation strings in the business features section #7268 - Fix: Add missing translation strings in the business features section #7268

View File

@ -52,6 +52,8 @@ class CategoryLookup {
add_action( 'generate_category_lookup_table', array( $this, 'regenerate' ) ); add_action( 'generate_category_lookup_table', array( $this, 'regenerate' ) );
add_action( 'edit_product_cat', array( $this, 'before_edit' ), 99 ); add_action( 'edit_product_cat', array( $this, 'before_edit' ), 99 );
add_action( 'edited_product_cat', array( $this, 'on_edit' ), 99 ); add_action( 'edited_product_cat', array( $this, 'on_edit' ), 99 );
add_action( 'created_product_cat', array( $this, 'on_create' ), 99 );
} }
/** /**
@ -130,6 +132,15 @@ class CategoryLookup {
$this->update( $category_id ); $this->update( $category_id );
} }
/**
* When a product category gets created, add a new lookup row.
*
* @param int $category_id Term ID being created.
*/
public function on_create( $category_id ) {
$this->update( $category_id );
}
/** /**
* Delete lookup table data from a tree. * Delete lookup table data from a tree.
* *