Quantcast
Channel: WordPress.org Forums » [WooCommerce] Support
Viewing all articles
Browse latest Browse all 104029

jimlongo on "[Plugin: WooCommerce - excelling eCommerce] appending info to product when added to cart"

$
0
0

I'm trying to use a filter action to add this info to the product_id

In my custom plug-in I have the following

/*ADD QUERY STRING TO PRODUCT WHNE PLACED IN CART */
add_filter ('woocommerce_product_title' , 'nfp_add_id_to_product');

function nfp_add_id_to_product(){
    $code = substr($_SERVER['QUERY_STRING'],5,12);
    $realcode = str_replace(array('-0', '-1'),array('-A', '-B'), $code);
    $product_id =   $realcode . '&' . $product_id ;
    return $product_id;

}

But all that gets passed to the cart is &, so I'm guessing the filter happens after we leave the page and cant' grab the query string.

Any ideas of what I could try.

I also tried an add_to_cart action but I don't feel like that is going to be completely useful.

Thanks.


Viewing all articles
Browse latest Browse all 104029

Trending Articles