Skip to content

Instantly share code, notes, and snippets.

@plugin-republic
Created January 17, 2023 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plugin-republic/1a63693b9bba53d867092050520472b0 to your computer and use it in GitHub Desktop.
Save plugin-republic/1a63693b9bba53d867092050520472b0 to your computer and use it in GitHub Desktop.
<?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