dfc35
Forum Replies Created
Viewing 4 replies - 1 through 4 (of 4 total)
-
Forum: Plugins
In reply to: [Business One ToolKit] 404 error with portfolioI fixed this by setting the permalink structure to default.
thanks for a great theme!
Forum: Plugins
In reply to: [WooCommerce] errors after update to 2.3.3Thank You!
Forum: Plugins
In reply to: [WooCommerce] errors after update to 2.3.3yes I deactivated all of them. same issue. Using Canvas Child Theme
I do have some custom code in the functions.php, adding products on the fly and adding them to the cart.
It seems to be an issue with this –
$woocommerce->cart->add_to_cart( $product_ID, $quantity=1 );
It does save the product but will not add it to the cart.
code below –
add_action('init', 'customcart'); function customcart() { if (isset($_POST["addcustomcarts"])) { global $woocommerce; $my_post = array( 'post_title' => 'My post', 'post_content' => 'This is my post.', 'post_status' => 'publish', 'post_author' => 1, 'post_type' =>'product' ); // Insert the post into the database $product_ID = wp_insert_post( $my_post ); if ( $product_ID ){ add_post_meta($product_ID, '_regular_price', 100 ); add_post_meta($product_ID, '_price', 100 ); add_post_meta($product_ID, '_stock_status', 'instock' ); //Getting error on this line. $woocommerce->cart->add_to_cart( $product_ID, $quantity=1 ); exit( wp_redirect( get_permalink( woocommerce_get_page_id( 'cart' ) ) ) ); } } }I would also like to know.
Viewing 4 replies - 1 through 4 (of 4 total)