Created
February 14, 2024 12:45
-
-
Save webdados/8db7a3aa5e86bd971c747576003d89d7 to your computer and use it in GitHub Desktop.
Filter to override/set the service cost on runtime on the Product Assembly / Gift Wrap / … Cost for WooCommerce plugin
This file contains 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 | |
/* Set the product assembly cost to 5 on two specific products - https://wordpress.org/plugins/product-assembly-cost/ */ | |
add_filter( 'product_assembly_cost', function( $cost, $product_or_variation ) { | |
if ( $product_or_variation->get_id() == 17536 || $product_or_variation->get_id() == 16932 ) { // Set whatever condition you want here | |
$cost = 5; | |
} | |
return $cost; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment