product

How to Show SKU with product title in Order received page and Email order

吃可爱长大的小学妹 提交于 2019-12-22 00:13:44
问题 In functions.php add_action( 'woocommerce_add_order_item_meta', 'custom_add_item_sku', 10, 3 ); function custom_add_item_sku( $item_id, $values, $cart_item_key ) { $item_sku = get_post_meta( $values[ 'product_id' ], '_sku', true ); wc_add_order_item_meta( $item_id, 'SKU', $item_sku , false ); } But its showing SKU value below Product title but i want it like this SKU:123sd - Product Name 回答1: Update 2018-04-01 - Changing of hook and Improved code. Use woocommerce_order_item_name filter hook

Add a drop down to product edit pages in product data “General” settings tab

∥☆過路亽.° 提交于 2019-12-21 22:07:12
问题 I am trying to figure out how to modify the singe product options so the product admin can pick from the drop down list the condition of product, i.e. new/ used. Below is a code that allows product admin to enter the condition of product manually. // Enabling and Displaying Fields in backend add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' ); function woo_add_custom_general_fields() { global $woocommerce, $post; echo '<div class="options_group">'

Adding Extra Add to cart button below product summary in Woocommerce

纵饮孤独 提交于 2019-12-21 20:57:18
问题 In WooCommerce, I am trying to add an extra add to cart button below product summary. I successfully added an extra button following this code which works for single products: add_action( 'woocommerce_single_product_summary', 'custom_button_after_product_summary', 30 ); function custom_button_after_product_summary() { global $product; echo "<a href='".$product->add_to_cart_url()."'>add to cart</a>"; } But if the product is a variation it doesn't work. please suggest as what to do? 回答1: I have

Remove single product tabs and add the related content instead In Woocommerce

和自甴很熟 提交于 2019-12-21 19:43:27
问题 I have a client who wants to pull the information that defaults into tabs on single product pages in WooCommerce into a different location on the page and remove the tabs entirely. There are three default product tabs: product Description, Additional Information and Reviews. Removing the tabs and setting up the Description to display was easy enough to set up in /wp-content/plugins/woocommerce/includes/wc-template-hooks.php : remove_action( 'woocommerce_after_single_product_summary',

Add custom content to WooCommerce product description

岁酱吖の 提交于 2019-12-21 17:52:40
问题 I'm trying to inject some text in my description ending. Is it possible with filter? Or do i need to do this via child theme? Been trying to find the hook for description but can only find one for short description. Example: This is a description. Just some sample text to fill the description out. What i want is to inject "This is the last line in the description" So the hole description would look like this. This is a description. Just some sample text to fill the description out. This is

Woocommerce - Only show grouped products parent in the loop

邮差的信 提交于 2019-12-21 06:45:20
问题 I'm building a store for books. I have a bunch of grouped products . My pain is, that woocommerce lists both type by default. I only need the parent of the group to be listed without childrens . Is there any hook or workaround for this? Thanks. 回答1: Try the following: add_action( 'woocommerce_product_query', 'so_27975262_product_query' ); function so_27975262_product_query( $q ){ $q->set( 'post_parent', 0 ); } The idea is that we're modifying the query such that it will only show top-level

Display a custom product field before short description in WooCommerce

时间秒杀一切 提交于 2019-12-21 06:06:27
问题 I've a problem with adding a new field in WooCommerce, before short description. I used script in functions.php and my new custom field is displayed correctly but: Short description disappear when use script, a new field is display fine. I can edit the content of a field on a product page, but I can't delete it. It is always the last value. How can I display this custom field without removing the product short description? How can I reset this custom field content? Here is my code: // Add a

Magento product listing using ajax

时光毁灭记忆、已成空白 提交于 2019-12-21 05:42:18
问题 I have to add 5 separate tabs like By category,our picks, most popular top rated, your favorites in home page itself and each of them should list out the products under that one without full page reloading. That is using ajax , is it possible in magento. If so please guide me on this. 回答1: One may call Magento controller actions with AJAX, just as Joseph said. We used an approach like this in one of our recent projects: New Module Create a new module and create a new controller within. This

Magento - get product collection of all products

会有一股神秘感。 提交于 2019-12-21 05:35:14
问题 I need a custom product collection of all products. Currently there are no categories which contain all products of the store (as there are 8000 products we can not add them in to one extra category). What I need is on a particular CMS page the product collection of all products is displayed. So far I have a CMS page with the block: {{block type="catalog/product_list" template="catalog/product/list.phtml"}} I have created an module to override 'Mage_Catalog_Block_Product_List' I believe the

Add shortened description under the product title in WooCommerce archive pages

你离开我真会死。 提交于 2019-12-21 05:32:36
问题 In Woocommerce archives pages, I should need to display couple of lines from the product description under each product title like it's shown in this image. How can I do that? 回答1: Updated: This custom function will shorten the product description (to a defined amount of words) and will display it under the title of each product in archive pages as shop: add_action('woocommerce_after_shop_loop_item_title', 'description_in_shop_loop_item', 3 ); function description_in_shop_loop_item() { global