woocommerce

Hide payment method based on product type in WooCommerce

帅比萌擦擦* 提交于 2021-02-16 03:54:00
问题 In WoCommerce, I would like to disable particular payment methods and show particular payment methods for a subscription products in WooCommerce (and vice versa). This is the closest thing we've found but doesn't do what I am expecting. Yes, there are plugins that will do this but we want to achieve this without using another plugin and without making our stylesheet any more nightmarish than it already is. Any help on this please? 回答1: Here is an example with a custom hooked function in

Programmatically created WooCommerce order have no tax for new users

可紊 提交于 2021-02-15 06:51:08
问题 Im using Gravity forms to create an WooCommerce order programmatically. If an email added to the form already exists, it takes the shipping and billing from the users account. This works and it adds the VAT correctly. For a user that is not logged in, they add name, email, phone and country to the form, and the user is created automatically. The order is created, and the user is added. But in this case, the AT is not added and I have to manually recalculate the order for the VAT to be added.

Programmatically created WooCommerce order have no tax for new users

♀尐吖头ヾ 提交于 2021-02-15 06:50:13
问题 Im using Gravity forms to create an WooCommerce order programmatically. If an email added to the form already exists, it takes the shipping and billing from the users account. This works and it adds the VAT correctly. For a user that is not logged in, they add name, email, phone and country to the form, and the user is created automatically. The order is created, and the user is added. But in this case, the AT is not added and I have to manually recalculate the order for the VAT to be added.

How to show the login and register form on two different pages with WooCommerce using templates

匆匆过客 提交于 2021-02-13 17:35:46
问题 I have a my-account page which is displaying the login and register form. Below is the screenshot. There is no css as of now. My issue is, I have to separate both the pages. I mean I have to create a login and register both pages separately. This is the whole code form-login.php <?PHP /** * Login Form * * This template can be overridden by copying it to yourtheme/woocommerce/myaccount/form-login.php. * * HOWEVER, on occasion WooCommerce will need to update template files, and you * (the theme

How to show the login and register form on two different pages with WooCommerce using templates

我的梦境 提交于 2021-02-13 17:35:32
问题 I have a my-account page which is displaying the login and register form. Below is the screenshot. There is no css as of now. My issue is, I have to separate both the pages. I mean I have to create a login and register both pages separately. This is the whole code form-login.php <?PHP /** * Login Form * * This template can be overridden by copying it to yourtheme/woocommerce/myaccount/form-login.php. * * HOWEVER, on occasion WooCommerce will need to update template files, and you * (the theme

Woocomerce Remove a specific cart items when adding to cart another specific items

余生颓废 提交于 2021-02-13 05:47:26
问题 Provided solution here Remove a specific cart item when adding to cart a specific product in Woocommerce works perfect for one product id. Is any way to do this for multiple id's? 回答1: Update 2 : The following code will work for multiple product IDs: add_action( 'woocommerce_add_to_cart', 'check_product_added_to_cart', 10, 6 ); function check_product_added_to_cart($cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data) { // Set HERE your targeted product ID $target

Woocomerce Remove a specific cart items when adding to cart another specific items

て烟熏妆下的殇ゞ 提交于 2021-02-13 05:44:00
问题 Provided solution here Remove a specific cart item when adding to cart a specific product in Woocommerce works perfect for one product id. Is any way to do this for multiple id's? 回答1: Update 2 : The following code will work for multiple product IDs: add_action( 'woocommerce_add_to_cart', 'check_product_added_to_cart', 10, 6 ); function check_product_added_to_cart($cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data) { // Set HERE your targeted product ID $target

Woocomerce Remove a specific cart items when adding to cart another specific items

穿精又带淫゛_ 提交于 2021-02-13 05:43:29
问题 Provided solution here Remove a specific cart item when adding to cart a specific product in Woocommerce works perfect for one product id. Is any way to do this for multiple id's? 回答1: Update 2 : The following code will work for multiple product IDs: add_action( 'woocommerce_add_to_cart', 'check_product_added_to_cart', 10, 6 ); function check_product_added_to_cart($cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data) { // Set HERE your targeted product ID $target

Woocommerce get_products return empty objects

妖精的绣舞 提交于 2021-02-11 17:42:20
问题 I'm building custom endpoint using Woocommerce Products and the query return 6 objects but empty don't now why is that? what I'm missing on my code below? Code add_action('rest_api_init', function () { register_rest_route( 'hash', 'related-products',array( 'methods' => 'GET', 'callback' => 'hash_realated_products' )); }); function hash_realated_products() { // Get 10 most recent product IDs in date descending order. $query = new WC_Product_Query( array( 'limit' => 6, 'status' => 'publish',

How to get “Terms & Conditions” Page ID in WooCommerce?

狂风中的少年 提交于 2021-02-11 17:17:17
问题 I'd like to know how to get the page which set as "Terms & Conditions Page" on "Appearance > Customize > WooCommerce > Checkout" on WordPress admin. I could get privacy policy page with "is_privacy_policy()", but don't know how to get "Terms & Conditions Page". I want to do this to make a plugin for WooCommerce not just for me but any person, so I can not know its page slug. Thank you. 回答1: First terms and conditions WordPress page need to be defined in WooCommerce Settings > Advanced > Terms