Created
April 25, 2019 18:07
-
-
Save mtruitt/19fc83b841294060b13ae72e3e66a577 to your computer and use it in GitHub Desktop.
Example of how to update postmeta on a new product.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function add_this_to_new_products( $product_get_id ) { | |
| $productType = WC_Product_Factory::get_product_type( $product_get_id); | |
| if( $productType == 'registrations') { | |
| update_post_meta( $product_get_id, '_tax_status', 'none' ); | |
| } | |
| } | |
| add_action( 'woocommerce_update_product', 'add_this_to_new_products', 10, 1 ); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This example is changing tax status to none on product type of registrations.