Last active
June 17, 2019 15:56
-
-
Save plugin-republic/4de94095fc3fa1f5375537d69271c731 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 custom cart item data | |
*/ | |
function plugin_republic_add_cart_item_data( $cart_item_data, $product_id, $variation_id ) { | |
if( isset( $_POST['pr-field'] ) ) { | |
$cart_item_data['pr_field'] = sanitize_text_field( $_POST['pr-field'] ); | |
} | |
return $cart_item_data; | |
} | |
add_filter( 'woocommerce_add_cart_item_data', 'plugin_republic_add_cart_item_data', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment