Category : cart

I am using this code, so users can add a product with a custom price (via url) to the cart. Also this makes them "Sold Individually" add_filter( ‘woocommerce_add_cart_item’ , ‘set_woo_prices’); add_filter( ‘woocommerce_get_cart_item_from_session’, ‘set_session_prices’, 20 , 3 ); function set_woo_prices( $woo_data ) { if ( ! isset( $_GET[‘agcs’] ) || empty ( $_GET[‘agcs’] ) ) { ..

Read more

I am trying to add a cart item meta with a custom input on cart page. I have added the input on the cart.php template: <div class="product-gift"> <?php $isgift = isset( $cart_item[‘isgift’] ) ? true : false; if (isset($_POST[‘gift-‘ . $cart_item_key])) { $isgiftval = $_POST[‘gift-‘ . $cart_item_key]; } else { $isgiftval = false; } ?> ..

Read more

I receive this error in my cart script. In local ( Wampserver ) work fine, but not in hosting. Problem as photo: Price (2,30) x quantity ( 1 ) = 2,00 and Notice: A non well formed numeric value encountered in….. enter image description here Code <?php $row_total_price = $arr_cart_p_current_price[$i] * $arr_cart_p_qty[$i]; $table_total_price = $table_total_price ..

Read more

I am trying to order the cart contents by date, the last one added or modified must be displayed first. I tried reversing the order of the cart but its not working as expected. This is the code I tried: //reorder cart add_action(‘woocommerce_cart_loaded_from_session’, ‘wh_cartOrderItemsbyNewest’); function wh_cartOrderItemsbyNewest() { //if the cart is empty do nothing if ..

Read more

Objective: add product to cart despite unselected variations, i.e. remove/disable the mandatory nature of variation fields. Issue: WooCommerce’s absolute requirement for all variations to be selected before adding to cart. Tried: filtering out/removing/disabling unselected variations before adding to cart using various hooks; woocommerce_before_calculate_totals, woocommerce_add_to_cart, woocommerce_add_cart_item, woocommerce_add_to_cart_validation I understand that this is how WooCommerce works and ..

Read more

I’m using Laravel to consume the Bigcommerce V3 API. I have ben able to succesfully create a new cart. But when trying to add an item to it, I keep getting a 422: Missing required fields error. I’m making my request trough Guzzle like this: return json_decode($this->client->getRestClient() ->post(‘carts/’.$cartId.’/items?include=line_items.physical_items.options’, [ ‘Accept’ => ‘application/json’, ‘json’ => [ ..

Read more