Use product-sale-price ID for hooks. Closes #42907. (#42908)

* Use product-sale-price ID for hooks. Closes #42907.

* attempt to add a changelog
This commit is contained in:
Kathy 2023-12-20 15:44:32 -05:00 committed by GitHub
parent e1e1d3c593
commit 4d7bf10c96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -0,0 +1,3 @@
Significance: patch
Type: fix
Comment: Fix incorrect sale price hook name in product editor example documentaion

View File

@ -63,7 +63,7 @@ function YOUR_PREFIX_remove_block( BlockInterface $sale_price_block ) {
$sale_price_block->remove(); $sale_price_block->remove();
} }
add_action( 'woocommerce_block_template_area_product-form_after_remove_block_sale-price', 'YOUR_PREFIX_remove_block' ); add_action( 'woocommerce_block_template_area_product-form_after_remove_block_product-sale-price', 'YOUR_PREFIX_remove_block' );
``` ```
### Conditionally hiding a block in product editor templates ### Conditionally hiding a block in product editor templates
@ -76,7 +76,7 @@ function YOUR_PREFIX_hide_block( BlockInterface $sale_price_block ) {
$sale_price_block->add_hide_condition( 'editedProduct.regular_price < 10' ); $sale_price_block->add_hide_condition( 'editedProduct.regular_price < 10' );
} }
add_action( 'woocommerce_block_template_area_product-form_after_add_block_sale-price', 'YOUR_PREFIX_hide_block' ); add_action( 'woocommerce_block_template_area_product-form_after_add_block_product-sale-price', 'YOUR_PREFIX_hide_block' );
``` ```
### Conditionally disabling a block in product editor templates ### Conditionally disabling a block in product editor templates
@ -89,7 +89,7 @@ function YOUR_PREFIX_hide_block( BlockInterface $sale_price_block ) {
$sale_price_block->add_disable_condition( '!editedProduct.regular_price' ); $sale_price_block->add_disable_condition( '!editedProduct.regular_price' );
} }
add_action( 'woocommerce_block_template_area_product-form_after_add_block_sale-price', 'YOUR_PREFIX_hide_block' ); add_action( 'woocommerce_block_template_area_product-form_after_add_block_product-sale-price', 'YOUR_PREFIX_hide_block' );
``` ```