product

Remove variation attribute drop downs in WooCommerce

自闭症网瘾萝莉.ら 提交于 2019-12-02 10:24:35
I am trying to remove the variations dropdown from a single product page, I have successfully removed the summary using... remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 20 ); But I have been unable to find a similar snippet to remove the dropdown. anyone have an example I can see? To remove the product excerpt you should normally use woocommerce_template_single_excerpt (with a priority of 20 ) like: remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 ); To remove (for variable products) the attribute

Only one currently added product into Woocommerce cart?

☆樱花仙子☆ 提交于 2019-12-02 10:14:26
问题 I would like Woocommerce to only allow 1 product in the cart. If a product is already in the cart and another one is added then it should remove the previous one. I found this code on net: /** * When an item is added to the cart, remove other products */ function custom_maybe_empty_cart( $valid, $product_id, $quantity ) { if( ! empty ( WC()->cart->get_cart() ) && $valid ){ WC()->cart->empty_cart(); wc_add_notice( 'Only allowed 1 item in cart, please remove previous item.', 'error' ); // here

Woocommerce - Retrieve shipping class

一个人想着一个人 提交于 2019-12-02 10:01:14
I use following code on external script to retrieve all products (simple and variable): $args = array( 'post_type' => array('product', 'product_variation'), 'numberposts' => -1, 'post_status' => 'publish', ); $shop_products = get_posts( $args ); foreach ($shop_products as $item) { echo $item->ID.": shipping class is -> ".$item->get_shipping_class()."<br>"; } I need to create a list of product with their own shipping class, but it doesn't works. It shows me the error " Call to undefined method WP_Post::get_shipping_class() ". What is wrong? How can I fix it? I have modified your code. Try

Conditional custom output around products sale price and regular price

谁都会走 提交于 2019-12-02 09:56:02
问题 I'm trying to work on a custom conditional output where when a product loop is found with sales price, it adds a class to the sale price tag. If there's only regular price, it adds this class to regular price tag. I can't seem to get this to work after looking on & off from different documentations: add_filter( 'woocommerce_get_price_html', 'custom_price_html', 100, 2 ); function custom_price_html( $price, $product ){ ob_start(); global $product; if (isset($product->sale_price)) { return str

Adding custom attribute to WooCommerce shop loop product title

…衆ロ難τιáo~ 提交于 2019-12-02 09:14:26
I am attempting to add a custom attribute to the WooCommerce loop. Currently I have the following in my functions file function cc_template_loop_product_custom_attribute() { $abv = $product->get_attribute('pa_alcohol-by-volume'); if (!empty($abv)) { echo get_attribute('pa_alcohol-by-volume'); }; } add_action('woocommerce_shop_loop_item_title', 'cc_template_loop_product_title', 10); The intention is to get display the attribute 'Alcohol by volume' after the product title. However this is not working and basically causing the loop to stop rendering as soon as it reaches the function. Calling get

Update Magento products with multiple images

戏子无情 提交于 2019-12-02 08:50:42
I'm developing a Magento store and I imported some products, but in these products there were more than just one image and when I imported the products just one came with, now I need to update all the products with the images left, somebody knows how to do it in some quick mode? Thanks! Step 1: Export All Products Before you begin, make sure that all changes to the product data have been saved. On the Admin menu, select System > Import/Export > Dataflow - Profiles. In the list of profiles, select Export All Products. In the panel on the left, click Run Profile. To begin the process, click the

Schema.org Product type has no property price?

♀尐吖头ヾ 提交于 2019-12-02 08:41:06
I have a webshop. On the product detail pages I use the Product type from schema.org: http://schema.org/Product It supports the properties name , description , image and url . However, it does not seem to support the inclusion of a "price" property, based on for example https://schema.org/price I find it weird that the Product definition does not seem to support a price. Or am I using the wrong type? Yes, the price property is not defined for the Product type . You might want to use the Offer type . Either on its own (instead of Product ), or in combination with Product (related via offers /

How to display tags product in view.phtml of Magento

百般思念 提交于 2019-12-02 07:42:43
I created new theme and use them for creating product. In view page, I don't see product tags. I review view.pthml in default and know that the tags in "echo $this->getChildHtml('product_additional_data') " , my view.phtml has it too but why it don't display tags plz, any advice This is what I did after about 4 hours of research. <?php // instantiate the tags class for products $_tags = new Mage_Tag_Block_Product_List(); ?> <ul class="product-tags"> <?php foreach($_tags->getTags() as $tag):?> <li><a href="<?=$tag->getTaggedProductsUrl()?>"><?=$tag->getName()?></a></li> <?php endforeach;?> </ul

Customizing Shop Page products to go straight to Affiliate Site

空扰寡人 提交于 2019-12-02 07:30:31
问题 What do I need to use on WooCommerce, so when you see a product on the shop/catalogue page it links straight through to the affiliate site and not via the single product page. Then if possible for that to open in a new tab. Thanks 回答1: Update: Added WC 3+ compatibility There is 3 related custom hooked functions for your case, that you will need to customize: ### Custom Product link ### // Removing the default hooked function remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce

Woocommerce variation product price to show default

风格不统一 提交于 2019-12-02 07:15:30
I have my store set up with product variations and at the moment on the product thumbnail pages i.e. category and filtering pages it shows a (from £xx to £xx) and when down to the single product page and the variation shave been selected to variation price shows. I have certain attributes set as defaults and this is the price I would prefer to show on the category pages... the standard size and cost. BUT i have no idea if its possible or what code to change it to. Is this possible? Any ideas? to juist display one standard price > go to the THEME folder and open functions.php and add this to