Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. function save_installation_charges( $cart_item_data, $product_id ) {
  2.  
  3. if( isset( $_REQUEST['wcic_installation_charges'] ) && !empty($_REQUEST['wcic_installation_charges']) ) {
  4.  
  5. /* This is where the installation charges is stored with cart item as variation */
  6. $cart_item_data[ 'wcic_installation_charges' ] = $_REQUEST['wcic_installation_charges'];
  7.  
  8. /* below statement make sure every add to cart action as unique line item */
  9. $cart_item_data['unique_key'] = md5( microtime().rand() );
  10. }
  11.  
  12. return $cart_item_data;
  13. }
  14. add_action( 'woocommerce_add_cart_item_data', 'save_installation_charges', 10, 2 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement