Search
 
SCRIPT & CODE EXAMPLE
 

PHP

woocommerce add custom field data to cart page

add_filter( "woocommerce_add_cart_item_data", "cs_add_cart_item_data", 10,2 );
function cs_add_cart_item_data( $cart_item, $product_id ){

  /*
  Custom Field name="" attr
  */
  if ( isset($_POST['custom_field_name']) ) {
    $cart_item['custom_field_name'] = sanitize_text_field( $getRawVal );
  }
  return $cart_item;
}
Comment

PREVIOUS NEXT
Code Example
Php :: php convert hex to rgba 
Php :: php mixing 2 string 
Php :: Add 2 hours to current time in cakephp 
Php :: datetime iso 8601 php 
Php :: Notice: Undefined property: enable_for_virtual 
Php :: laravel blade time difference 
Php :: upload file laravel 
Php :: guzzle post request with data 
Php :: laravel queue work on shared hosting 
Php :: laravel timestamps on pivot table 
Php :: eloquent get query log 
Php :: deleteall in cakephp 
Php :: laravel get last get request 
Php :: alter mysql 8 user root phpmyadmin first install 
Php :: Artisan::call for all catch clear in laravel 
Php :: php get values that exist in both arrays 
Php :: php mysql if not exists insert 
Php :: curl exec not working php 
Php :: sql repare php 
Php :: laravel date set timezone 
Php :: render vs redirect laravel exception 
Php :: php remove prefix from string 
Php :: add acf options page 
Php :: random string in laravel 
Php :: larevel version artisan 
Php :: php closecursor 
Php :: replace accent php 
Php :: laravel @canany 
Php :: invalid datetime format 1292 
Php :: symfony password generator command line 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =