Created
January 17, 2023 13:01
-
-
Save plugin-republic/1a63693b9bba53d867092050520472b0 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* Add cart item data. | |
* | |
* @param Array $cart_item_data Cart item meta data. | |
* @param Integer $product_id Product ID. | |
* @param Boolean $variation_id Variation ID. | |
* | |
* @return Array | |
*/ | |
function wcraq_add_cart_item_data( $cart_item_data, $product_id, $variation_id, $quantity=0 ) { | |
$product = wc_get_product( $product_id ); | |
if( wcraq_is_product_quotable( $product ) ) { | |
$cart_item_data['wcraq_is_quotable'] = true; | |
} | |
return $cart_item_data; | |
} | |
add_filter( 'woocommerce_add_cart_item_data', 'wcraq_add_cart_item_data', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment