Last active
October 23, 2018 21:53
-
-
Save pablo-sg-pacheco/1b17054b8a2cb948df6b4d1e38cfb002 to your computer and use it in GitHub Desktop.
Product Open Pricing (Name Your Price) for WooCommerce - Add to cart programmatically
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 characters
<?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