product

Replace add to cart button with a custom button on WooCommerce

十年热恋 提交于 2019-12-08 10:38:15
问题 I would like to replace the 'Add to cart' button for a specific product category and when product type isa a 'simple product' . I would like to do that on the page where I can see all the products (shop and archive pages) and in single product pages. The code bellow just hide my add-to cart buttons from all post of my product category: function western_custom_buy_buttons(){ $product = get_product(); if ( has_term( 'categ1', 'product_cat') ){ // removing the purchase buttons remove_action(

nopCommerce 2.40 Admin Product Edit Addition

杀马特。学长 韩版系。学妹 提交于 2019-12-08 09:29:11
问题 Hopefully I can get some headway here as nopCommerce forums has been silent to my post. My current situation is that for each product we have in our store, we(admins) need to upload a specific document and have that document show to the end user when they are browsing the product detail section, through means of a link and download. So I figured I would chop this project up and first attempt to develop the upload function from the admin area. In case anyone else can help but doesn't know

Get the orders IDs related to a product bought by a customer in Woocommerce

╄→尐↘猪︶ㄣ 提交于 2019-12-08 08:49:02
问题 I have the products ids as an array and I would like to get the list of order ids if the customer has purchased that product. I have the customer purchased product ids with me. Somehow, I have to get the linked order id and cancel that order if customer purchases new product. To check if a customer has purchased a product I am using the function has_bought_items() from this answer thread: Check if a customer has purchased a specific products in WooCommerce May be it can be tweaked to get the

Changing user role after purchasing a products in WooCommerce

痞子三分冷 提交于 2019-12-08 08:12:00
问题 I have a need to build two plans (paid) on my site. If the user buys Gold Plan it should create a user (role) Gold and give him 20% discount on travel packages. If user buys platinum wp should create 'Platinum' user role for that customer. Now I have found the code online but it does not work: add_action( 'woocommerce_order_status_completed', 'wpglorify_change_role_on_purchase' ); function wpglorify_change_role_on_purchase( $order_id ) { // get order object and items $order = new WC_Order(

Adding Custom Meta Data from Products to Orders items in Woocommerce

可紊 提交于 2019-12-08 07:58:14
问题 I'm trying to get the Custom Meta data of my woocommerce products to my Order Columns in my Woocommerce Admin but this code wont work on my function.php in Wordpress Theme. // Order Get Meta for PD Number add_action('woocommerce_add_order_item_meta','adding_custom_data_in_order_items_meta', 1, 3 ); function adding_custom_data_in_order_items_meta( $post_id, $cart_item_key ) { // The corresponding Product Id for the item: $product_id = $post_id[ 'product_id' ]; //$pd_number = $post_id['_pd

How to loop product name and photos in my-orders.php page for recent orders?

纵饮孤独 提交于 2019-12-08 07:06:38
问题 I have to add product name and thumbnail to my recent orders page. I don't know how to loop them if there are more than one product in one order. (Dead image link removed) 回答1: I have Just set the loop for products names, but i haven't test it. You will have to search for thumbnails (see the link at the end). For the products loop, i have use the code from Sandeep Kumar: WooCommerce display order product name in my account foreach($order->get_items() as $item) { $product_name = $item['name'];

Display lowest variation price and discounted percentage in WooCommerce

人盡茶涼 提交于 2019-12-08 06:53:00
问题 Based on this post : Displaying the lowest variation price of variable products And this topic : Display the discounted percentage near sale price in Single product pages for WC 3.0+ I've been trying to show everywhere on my website the lowest variation price with the associated discount %, for variable and non variable products. Here is the current code that I am using: add_filter( 'woocommerce_variable_price_html', 'bbloomer_variation_price_format', 10, 2 ); function bbloomer_variation

Close WooCommerce Product Tabs by default

天大地大妈咪最大 提交于 2019-12-08 06:15:33
问题 By default Product Tabs in WooCommerce auto opens the first one. Is it possible to have them all closed by default, requiring you to click it to see more? I have tried the following code, but it does not seem to do it. Perhaps there is a PHP code that does it or something simple? I already tried this without luck : setTimeout(function() { var $tabs = jQuery( '.wc-tabs, ul.tabs' ).first(); $tabs.parent().find('#tab-description').hide(); $tabs.parent().find( '.tab-title-description' )

UWP trial version and products purchase that make full version with expiration

旧时模样 提交于 2019-12-08 06:11:43
问题 I'm working with UWP and trying to make the app with a trial version (1 month) and products purchase that make full version with expiration (1 month and 1 year). The general idea is, when the user downloads for first time the app, he has a trial period of 1 month with ads. After the month of trial version the app asks that need to buy a product with a periord of time and with this remove adds. The problem is that I don't know how to make at same time the buy of full version and product

Product additionnal buttons in Woocommerce

筅森魡賤 提交于 2019-12-08 06:08:53
问题 In Woocommerce, how do I add a "Continue" button inked to the the product page just after? And inside the product page how to add a checkout button just under the add to cart button? Any help is appreciated. 回答1: The following code will: In woocommerce archive pages: Add an additional button "Continue" linked to the product (for simple products) In single product pages: Add an additional button linked to checkout page. The code: // Archives pages: Additional button linked to the product add