Last active
August 8, 2019 14:19
-
-
Save rcstr/f72c8dff0faa0910068b813b509b6d77 to your computer and use it in GitHub Desktop.
Revisions
-
rcstr revised this gist
Aug 8, 2019 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -6,6 +6,14 @@ function cstr_add_cart_item_data( $cart_item_data, $product_id ) { } else { return; } if ( empty( $cart_item_data['my_field'] ) ) { $cart_item_data['my_field'] = array(); } // add my data. return $cart_item_data; } // Add item data to the cart. -
rcstr created this gist
Aug 8, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ <?php function cstr_add_cart_item_data( $cart_item_data, $product_id ) { if ( isset( $_POST ) && ! empty( $product_id ) ) { $post_data = $_POST; } else { return; } } // Add item data to the cart. add_filter( 'woocommerce_add_cart_item_data', 'cstr_add_cart_item_data', 10, 2 );