cart

Dynamic price calculation based on custom field in Woocommerce

北城以北 提交于 2019-12-01 21:21:27
In Woocommerce on each product page there is a Text Box, which allows users to enter their own custom text. This text is then applied to the product, with the customer being charged on a per letter basis. I have managed to get everything working, apart from the Maths Logic. When a visitor enters x amount of letters, the current Maths logic correctly calculates the Product Price + Cost of Custom Letters and outputs this sum to the Basket Widget. Where I am running into problems, is when the visitor goes to the Basket Page, the Cost of the Custom Lettering is doubled. I just cannot seem to work

Disable all payments gateway if there's specifics products in the Cart

微笑、不失礼 提交于 2019-12-01 13:02:41
I would like to disable all payments gateways under special situation: I've 2 special products that I don't want to be combined at checkout with any other product. Lets say that my "special" products IDs are 496 and 484 . All other are "normal" products. if one of these "special" products is in the cart, I want to disable "paypal" for example. if a customer has in his cart, at once, a "special" product and a "normal" product, I want to disable all the payments gateway , so he can't checkout. This is my code: //disable add to cart if add_filter( 'woocommerce_available_payment_gateways', 'filter

Add custom calculation to cart total and grand total in magento

家住魔仙堡 提交于 2019-12-01 12:57:39
I am working on site where i want to add/subtract fee to cart total and grand total.I am firing this event to capture the cart details. sales_order_save_after . while in observer i got the price using this code public function modifyPrice(Varien_Event_Observer $obs) { $getotal = Mage::helper('checkout')->getQuote()->getGrandTotal(); $totals = Mage::getSingleton('checkout/session')->getQuote()->getTotals(); $subtotal = $totals["subtotal"]->getValue(); }. But i don't know how to add/subtract amount from total and than update accordingly.Thanks in advance Rehman, i am afraid this is not a

Unset removed cart item notice on WooCommerce cart page

旧街凉风 提交于 2019-12-01 12:13:00
Is there a way to hide/remove the notice "Product removed. Undo?" on the cart page, when the customer removed the item from the cart? I tried: add_filter( 'woocommerce_cart_item_removed_title', '__return_null' ); but this only hides the title of the product, that has been removed... I couldn't find the right hook of the rest of the line ("removed" and "Undo?") To unset " {item_name} removed. Undo? " notice on cart page, you can trick Woocommerce with the following: add_action( 'template_redirect', 'null_removed_cart_item_message' ); function null_removed_cart_item_message() { // Only on cart

WooCommerce - unset “<product> removed notice…” on cart page

爷,独闯天下 提交于 2019-12-01 11:54:37
问题 actions and filters. On my WooCommerce site I get the following message when I remove a product from the shopping cart: "<product name>" removed. Undo? Looking over WooCommerce source code I have found a conditional statement in class-wc-form-header.php as part of the function update_cart_action() : $removed_notice .= ' <a href="' . esc_url( WC()->cart->get_undo_url( $cart_item_key ) ) . '">' . __( 'Undo?', 'woocommerce' ) . '</a>'; But I can't find the way to use it for eliminate this notice

Displaying product thumbnail and attribute in Woocommerce cart and checkout

强颜欢笑 提交于 2019-12-01 11:45:27
I am isplaying product attributes in my Woocommerce checkout table, see my previous question: Show Woocommerce taxonomy in emails I also want to show the product image, so my ideal would be: Product image on the left and beside it product name, in the next row product quantity and after that the attribute. If I use this function add_filter( 'woocommerce_cart_item_name', add_thumbnail_to_cart_items, 10, 3 ); function add_thumbnail_to_cart_items( $product_name, $cart_item, $cart_item_key ){ if ( ! is_checkout() ) return $product_name; $product = $cart_item['data']; $thumbnail = $product->get

Display coupon description woocommerce

孤人 提交于 2019-12-01 11:40:27
I am trying to display coupon description once the coupon is applied (10%) in cart page. To display Total I am using $woocommerce->cart->cart_contents_total How do I display coupon description? As you have not mentioned where do you want to have coupon description, I have printed it just before Cart Total . If you want to have it on different place, you can modify action . You can find it from here . Code: add_action('woocommerce_before_cart_totals', 'apply_product_on_coupon'); function apply_product_on_coupon() { global $woocommerce; if ( ! empty( $woocommerce->cart->applied_coupons ) ) { $my

Auto apply a percentage or fixed cart discount based on the total in WooCommerce

╄→尐↘猪︶ㄣ 提交于 2019-12-01 10:45:32
I'm trying to set up a coupon on my client's WooCommerce site so that a percentage discount applies if the total cart is below a cap amount or a fixed amount is equal or greater than the cap amount. Let's say that the cap for the cart total is 200. If the cart total is below this cap, 10% discount is applied. But if the cart total is 200 or greater, then the fixed amount of 20 is applied as the discount. For example: My cart total is 190. Since this is less than the cap of 200, the discount amount is computed as 10%, which is 19 is applied My cart total is 210. Since this is greater than the

How to set a shipping cost by item in Woocommerce

最后都变了- 提交于 2019-12-01 10:36:32
In Woocommerce, when I add multiple products in cart, the shipping only applies to to 1 product. How should I change that to apply the cost to each item? Like in the following image, the shipping cost for printer is applied but the LCD monitor is not. How to set a shipping cost by item in Woocommerce? In the Woocommerce Shipping Settings for "Flat rate" Shipping Method, there is many ways to get dynamic settings based on: Item quantity, using [qty] argument Total item cost, using [cost] argument A fee, using [fee] argument with additional parameters percent , min_fee and max_fee You can also

Add a custom product calculated price to Woocommerce cart

自古美人都是妖i 提交于 2019-12-01 09:32:07
In woocommerce I have added an extra text field before add to cart button to add custom charge on product purchase. This plugin will add extra text field to single product page and calculates total plus the extra charge. My problem is that I cant add custom cart totals and the extra charge add before totals I tried woocommerce_cart_calculate_fees but no luck it only show $0 in totals PHP code: /** * Check if woocommerce is active and or installed. */ if ( class_exists( 'WooCommerce' ) || in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) )