Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function save_installation_charges( $cart_item_data, $product_id ) {
- if( isset( $_REQUEST['wcic_installation_charges'] ) && !empty($_REQUEST['wcic_installation_charges']) ) {
- /* This is where the installation charges is stored with cart item as variation */
- $cart_item_data[ 'wcic_installation_charges' ] = $_REQUEST['wcic_installation_charges'];
- /* below statement make sure every add to cart action as unique line item */
- $cart_item_data['unique_key'] = md5( microtime().rand() );
- }
- return $cart_item_data;
- }
- add_action( 'woocommerce_add_cart_item_data', 'save_installation_charges', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement