Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Product Open Pricing (Name Your Price) for WooCommerce - Add to cart programmatically
<?php
add_action('wp_loaded',function(){
if( is_admin() ){
return;
}
$product_id = 161;
$quantity = 1;
$variation_id = 0;
WC()->cart->add_to_cart( $product_id, $quantity, $variation_id, array(), array(
'alg_open_price' => 99
));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.