product

Change Add To Cart button text based on Woocommerce parent product categories

拜拜、爱过 提交于 2019-12-08 04:21:56
问题 I am using the following code to change the wording on a Woo product add to cart button based on its parent category. The code works but has the following bug. If one of the parent categories is empty (i.e. does not have any sub cats) then the code no longer works. So the current code must be missing a string to check if parent category is empty or not but I do not know how to code that. This is the snippet I am running: // Utility function to get the childs array from all parent categories

Hide “out of stock” products with custom meta data In Woocommerce

馋奶兔 提交于 2019-12-08 03:29:51
问题 I'm working on a WooCommerce webshop at the moment and I've added a custom meta field named external_stock where WP All Import imports the stock that is available at our supplier for all of our products every 3 hours. The amount of products we've got in our actual store is being entered in the normal stock field. What I'm trying to achieve is that the products from which the normal stock and the external_stock are both 0 are not being displayed in the webshop. I've already edited a plugin in

Display price on add to cart button from the functions.php file in Woocommerce

落花浮王杯 提交于 2019-12-08 02:02:01
问题 Been trying to find something about this, but the solutions I found so far here do not work. I need, in the single product page, to display the add to cart button like this: ADD TO CART - JUST $PRICE It needs to be done from the functions.php file in the child theme. Thanks a lot! 回答1: To handle the display of the product price in add-to-cart button for all product prices on shop, other archives pages and single product pages, without any need of overriding templates , using dedicated

Sell some products only on a specific day in WooCommerce

你说的曾经没有我的故事 提交于 2019-12-08 01:26:27
问题 With Woocommerce I would like to sell certain defined items on Sunday only . If anyone tries to purchase outside of Sunday, it should give an error . The remaining items in the shop can be purchase anytime. Is this possible? Any track is really appreciated. Example - I have a product called “Sunday Tapas” which is product code “2795”. I want this product available on Sunday’s only. Everything else in the store should be available everyday as normal. 回答1: Based on "Enable Woocommerce shop

Sort products by DESC order in Woocommerce

為{幸葍}努か 提交于 2019-12-07 23:06:49
问题 I wrote this code in functions.php file of my active theme: add_filter( 'woocommerce_get_catalog_ordering_args', 'custom_woocommerce_get_catalog_ordering_args' ); function custom_woocommerce_get_catalog_ordering_args( $args ) { $orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) ); if ( 'random_list' == $orderby_value ) { $args['orderby'] = 'date'; $args[

Changing the number of columns in archive pages in woocommerce

余生颓废 提交于 2019-12-07 19:27:47
问题 How can I change the number of columns in archive pages in woocommerce? It shows 3 in shop pages, but 4 in archive pages. Thanks 回答1: This snippet code will change the number of products per page on all archives pages: add_filter('loop_shop_columns', 'loop_columns'); if (!function_exists('loop_columns')) { function loop_columns() { return 3; } } This code goes on function.php file of your active child theme or theme Advice: Sometimes, is necessary to change some css rules, to get the correct

MySQL query to change variable product price in WooCommerce

蹲街弑〆低调 提交于 2019-12-07 16:19:59
问题 I want to change the prices for variable products in woocommerce. I tried with below MySQL query to do it, UPDATE wp_postmeta SET meta_value = price_value WHERE post_id = variation_id AND meta_key = '_sale_price'; but its updating only in backend(DB and admin area) not in front-end. Actually in front-end its not showing sale price also. As I'm not good at SQL, is there any code snippet or WooCommerce hook which allows me to change the price for a variable product? Thanks. 回答1: If you want to

Make my own Eclipse Intro page

喜夏-厌秋 提交于 2019-12-07 09:53:21
问题 I am facing difficulties to make my own Eclipse Intro Page (as shown here). It seems that I have some probleme with my product ID but I dont know how to get a product ID, I have tried to extend org.eclipse.core.runtime.products but when it asks me which application I want to register I dont know what to answer and it seems to be part of the problem ... anyone as any idea ? 回答1: Do you need to define a new id, or do you just want a minimal config that will show only your content? If it is the

add product to cart with custom options

≯℡__Kan透↙ 提交于 2019-12-07 09:31:56
问题 I have to create a (virtual, simple )product and then add to cart both programmatically, i have done this so far. now i have to set custom options when this product add to cart. but nothing happens . here is my code $product = Mage::getModel('catalog/product')->load($product_id); $cart = Mage::getModel('checkout/cart'); $cart->init(); $params = array( 'product' => $product->getId(), // This would be $product->getId() 'qty' => 1, 'options' => array( 34 => "value", 35 => "other value", 53 =>

Cart products dissapear on refresh page Prestashop

淺唱寂寞╮ 提交于 2019-12-07 07:42:26
since some weeks I have a problem with my Prestashop 1.4.0.12 When I add a product to cart, ajax works correctly and add the product very well. But, if I change page, or sometimes adding a product, the cart change deleting all products on refresh a new page. Sometimes I can move within some pages, but dissapears the products of the cart and later if I have a new cart returns to the old cart. Anybody knows about it? I think that the problem is on id_guest but I need to know if anyone have some solution Thanks! The problem is on Domain Name, that site have 3 domains, and there are a function on