price

Hide product prices and add-to-cart buttons but not variations for unregistered users in WooCommerce

女生的网名这么多〃 提交于 2020-01-02 06:58:39
问题 In my WooCommerce shop I want to hide the prices until the customer has logged in. I've got the following code working that does exactly that: add_action('init','hide_price'); function hide_price(){ if(!is_user_logged_in()){ remove_action('woocommerce_after_shop_loop_item','woocommerce_template_loop_add_to_cart',10); remove_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart',30); remove_action('woocommerce_single_product_summary','woocommerce_template_single

Hide product prices and add-to-cart buttons but not variations for unregistered users in WooCommerce

瘦欲@ 提交于 2020-01-02 06:58:00
问题 In my WooCommerce shop I want to hide the prices until the customer has logged in. I've got the following code working that does exactly that: add_action('init','hide_price'); function hide_price(){ if(!is_user_logged_in()){ remove_action('woocommerce_after_shop_loop_item','woocommerce_template_loop_add_to_cart',10); remove_action('woocommerce_single_product_summary','woocommerce_template_single_add_to_cart',30); remove_action('woocommerce_single_product_summary','woocommerce_template_single

Enable Wholesale prices in Woocommerce 3

♀尐吖头ヾ 提交于 2019-12-30 10:34:42
问题 In wooCommerce, I have added a custom meta field with a custom price (wholesale price) in edit product pages settings. Everything works well. When I set a wholesale price it works fine everywhere. But if I try to change this wholesale price it doesn't work. the old price remains everywhere. What I am doing wrong? How can I solve this problem to allow wholesale price changes? The code I am using: function w4dev_get_wholesale_price( $product ) { if( $product->is_type( array('simple', 'variable'

Display on a page all products below a specific price in Woocommerce

旧时模样 提交于 2019-12-25 00:04:11
问题 I have a Woocommerce store with more than 1000 products. I would like that all products which have a price below 999 should be shown on a separate page, so I can tag that Page in my menu. Is it possible? 回答1: Update: (added 'type' => 'DECIMAL', to the meta_query array) This can be done using Woocommerce shortcode [products] to be used on a page, with the following additional code (that will add the possibility to define a price to be compared through an existing argument) : add_filter(

GCP : Is there any exchangeable format to get revised price value immediately?

房东的猫 提交于 2019-12-24 12:14:50
问题 We are working in one of the customer module. With the help of this module, we are calculating price for google cloud components like compute engine with attributes images, boot disk, region, snapshot etc. But we found that GCP is revising the prices and JSON is not modifying immediately. Newly revised pricing values comes in JSON after few days. So the price according to JSON and price in google cosole/calculator are different in this case. Is there any exchangeable format to get revised

Set Woocommerce cart item price to zero if the product has already been bought

杀马特。学长 韩版系。学妹 提交于 2019-12-24 09:39:17
问题 I am unable to override price on second time purchase. The use case would be: If a user has already bought product "944" then the price would be 0 for next time orders. Meaning, the customer would pay only for first order of that specific product and it would be free for next orders. Here my code: // Enter the ID of the product that shouldn't be purchased again $no_repeats_id = 944; $no_repeats_product = wc_get_product( $no_repeats_id ); // Get the current product to check if purchasing

Hide the “free trial” text from Woocommerce Subscriptions price

大兔子大兔子 提交于 2019-12-24 07:39:09
问题 I am trying to remove the "with a XX day free trial" from my product, cart and checkout pages. I need to have the feature still work without having to express it in the product details. 回答1: It is possible using the filter hook 'woocommerce_subscriptions_product_price_string' for this hooked function, this way: add_filter( 'woocommerce_subscriptions_product_price_string', 'subscriptions_custom_price_string', 20, 3 ); function subscriptions_custom_price_string( $price_string, $product, $args )

How to display Woocommerce product price by ID with correct Commas?

两盒软妹~` 提交于 2019-12-24 07:17:06
问题 I was trying to display the price of a product on a custom page through a short code. I found this thread: How to display Woocommerce product price by ID number on a custom page? With this CODE: function so_30165014_price_shortcode_callback( $atts ) { $atts = shortcode_atts( array( 'id' => null, ), $atts, 'bartag' ); $html = ''; if( intval( $atts['id'] ) > 0 && function_exists( 'wc_get_product' ) ){ $_product = wc_get_product( $atts['id'] ); $html = "price = " . $_product->get_price(); }

Prestashop 1.6 - price saving issue.

六月ゝ 毕业季﹏ 提交于 2019-12-24 06:45:30
问题 In my Ecommerce site made in Prestashop version 1.6, when I update price of an item from administrative panel , it randomly gets affected. Sometimes the price change saved does not get implemented. The site is live and had been working so far but found this issue recently. 回答1: It's a bug of browsers: forge.prestashop.com This the post on the forum: PrestaShop forum This should be fix your problem: GitHub temporary fix The final fix (merged in the main project): GitHub full fix EDIT: A

Add the discounted percentage to variable product price range in Woocommerce

人走茶凉 提交于 2019-12-24 05:10:39
问题 Using Woocommerce, I have successively removed sale badges and prices from product archives pages with the following code: // Remove Sales Flash add_filter('woocommerce_sale_flash', 'woo_custom_hide_sales_flash'); function woo_custom_hide_sales_flash() { return false; } // Remove prices on archives pages remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); All the products are variable products and all variations have the same prices. Also actually