checkout

Change “Billing Details” text to “Shipping Details” on Woocommerce checkout page

旧城冷巷雨未停 提交于 2019-11-28 11:51:05
I currently have a bit of code in my child theme's functions.php file which is supposed to change "Billing Details" to say "Shipping Details" on my Woocommerce checkout page. However, when I updated to Woocommerce 3.0, the code snippet stopped working. Below is the code I was using. function wc_billing_field_strings( $translated_text, $text, $domain ) { switch ( $translated_text ) { case 'Billing Details' : $translated_text = __( 'Shipping Details', 'woocommerce' ); break; } return $translated_text; } add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 ); I would really like a code

WooCommerce - Overriding billing state and post code on existing checkout fields

寵の児 提交于 2019-11-28 11:47:55
I can't find the way to ovveride billing state and post code. How can I edit the other parts of existing billing fields like billing state and post code? This is what I have in the functions.php file in my child theme (I have included the code affecting the billing part): <?php function my_custom_checkout_field( $checkout ) { global $wpdb; $check_zone = $wpdb->get_results("select area_name from brick_area where id='".$_SESSION['area']."'",ARRAY_A); if(!empty($check_zone)){ $check_zoneid = $check_zone['0']; } woocommerce_form_field( 'my_field_name', array( 'type' => 'text', 'class' => array('my

Add a fee based on shipping method and payment method in Woocommerce

时光怂恿深爱的人放手 提交于 2019-11-28 09:51:01
问题 I need to apply an additional fee when a customer can place an order with free shipping, but wants to select COD payment. So, Free Shipping + COD payment => fee. I tried unsuccessfully the following piece of code. Where am I wrong? add_action( 'woocommerce_cart_calculate_fees','cod_fee' ); function cod_fee() { global $woocommerce; if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; $chosen_gateway = WC()->session->chosen_payment_method; $chosen_methods = WC()->session->get( 'chosen

Get Cart products id on checkout WooCommerce page, to display product images

有些话、适合烂在心里 提交于 2019-11-28 08:50:25
I'm using woocommerce on a site I'm working on and I want to display the current product thumbnail at the top of the checkout page, so the user could take a look at what his going to buy. However I can't find any way to do so. The closest I got, is to use WC::cart->get_cart() , but this outputs a list of all products. How can I achieve this? Thanks Yes it's possible writing a custom function. To display those images at the beginning of checkout page just after your header's theme, use this code: add_action('woocommerce_before_checkout_form', 'displays_cart_products_feature_image'); function

Not able to change checkout/cart.phtml through layout update

假如想象 提交于 2019-11-28 06:12:52
问题 I am trying to change checkout/cart.phtml through layout update in my module's layout file i.e. mymodule.xml <layout> <checkout_cart_index> <reference name="checkout.cart"> <action method="setCartTemplate"><value>mymodule/checkout/cart.phtml</value></action> </reference> </checkout_cart_index> </layout> But It is not working. Any clues? 回答1: The method is setTemplate not setCartTemplate, like so: <layout> <checkout_cart_index> <reference name="checkout.cart"> <action method="setTemplate">

Additional field on checkout for specific payment gateway in Woocommerce

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 06:04:34
问题 I have a custom Woocommerce payment gateway and I need to add additional field on the checkout when the payment is selected. Basically, when the users click the custom payment gateway a "select" field should appear and they have to choose something from the select field. I have attached a screenshot to represent better the idea of what I need to do. Unfortunately, I couldn't find any info about that in the Docs. 回答1: The following code will append to the gateway description in checkout page,

Remove shipping Flat Rate method for particular Category in WooCommerce 2.6 and 3+

狂风中的少年 提交于 2019-11-28 05:53:01
问题 I need help in woocommerce shipping options, I want to hide flat rate for a particular product category, where I only want to show local delivery or local pickup options. For all others categories all options should work. I have try to do it with that code (added in function.php file of my theme): function cart_has_product_with_orange_cats() { global $woocommerce; $product_in_cart = false; // start of the loop that fetches the cart items foreach ( $woocommerce->cart->get_cart() as $cart_item

Checkout fields: Hiding and showing existing fields

守給你的承諾、 提交于 2019-11-28 02:16:09
问题 Based on this working answer: // Registering external jQuery/JS file function cfields_scripts() { // IMPORTANT NOTE: // For a child theme replace get_template_directory_uri() by get_stylesheet_directory_uri() // The external cfields.js file goes in a subfolder "js" of your active child theme or theme. wp_enqueue_script( 'checkout_script', get_template_directory_uri().'/js/cfields.js', array('jquery'), '1.0', true ); } add_action( 'wp_enqueue_scripts', 'cfields_scripts' ); add_filter(

Changing WooCommerce cart item names

孤街浪徒 提交于 2019-11-28 01:44:06
问题 The goal is to change the name of the item as it gets passed to our payment gateway, but leave it as-is for display on our product pages. I've tried this in my functions.php: function change_item_name( $item_name, $item ) { $item_name = 'mydesiredproductname'; return $item_name; } add_filter( 'woocommerce_order_item_name', 'change_item_name', 10, 1 ); But it doesn't seem to be working for me. I feel like I should be passing in an actual item ID or something… I'm a little lost. Any information

PayPal checkout - credit card tab by default

好久不见. 提交于 2019-11-27 22:26:49
Is there anyway to make that the part where you enter your credit card information is open by default, instead of the part where you enter your paypal information? I really need this, but wasn`t able to find anywhere! Drew Angell The only way to do that is with Express Checkout . In your SetExpressCheckout request you set SOLUTIONTYPE=Sole and LANDINGPAGE=Billing. This will force the full credit card form to be displayed so people can enter a credit card without creating a PayPal account... This can't be done with Payments Standard , unfortunately. "Guest Checkout" is available with Payments