product

Unset product tabs for specific product categories in woocommerce

拥有回忆 提交于 2019-12-17 22:01:36
问题 I am using the code coming from this answer: Hiding tabs only for some products in WooCommerce single product pages Here is that code: add_filter( 'woocommerce_product_tabs', 'conditionaly_removing_product_tabs', 98 ); function conditionaly_removing_product_tabs( $tabs ) { // Get the global product object global $product; // Get the current product ID $product_id = method_exists( $product, 'get_id' ) ? $product->get_id() : $product->id; // Define HERE your targetted products IDs in this array

Get all Orders IDs from a product ID in Woocommerce

亡梦爱人 提交于 2019-12-17 21:34:20
问题 How can I get an array with Order IDs by Product ID? I mean receive all orders where specific product is presented. I know how to do this by MySQL, but is there a way to do this by WP_Query function? 回答1: Updates: 2017 - SQL query changed to "SELECT DISTINCT" instead of "SELECT" to avoid duplicated Order IDs in the array (then no need of array_unique() to filter duplicates…). 2019 - Enabled product variation type support in the SQL Query Then you can embed this in a custom function with

Adding custom text labels to the prices when products are on sale

余生长醉 提交于 2019-12-17 20:53:57
问题 On WooCommerce product single pages, if a product owns a sales price, the normal price is crossed out and behind it, the sale price is highlighted. My question: How can I add a label like "Old Price: XX Dollar" and "New Price: XX Dollar" instead of only the crossed out and the new price (sale price)? 回答1: Update 2 (for simple and variable products + solved the bug on same variations prices) when products are on sale, you can add custom labels just as you want using a custom function hooked in

Ios how to get a list of already purchased products?

时光毁灭记忆、已成空白 提交于 2019-12-17 20:28:51
问题 I'm building an app that uses In app purchase. I'm using non-consumable product types. Everything works ok (setting up products, buying...). What I would like to do is to verify which products a user had already purchased (when reinstalling app or changing device)? Is that possible? Thanks 回答1: See the Restoring Transactions section of the In-App Purchase guide. Here is what it specifically says: Store Kit provides built-in functionality to restore transactions for non-consumable products,

Greying out out-of-stock product variations (WooCommerce)

社会主义新天地 提交于 2019-12-17 19:56:22
问题 [EDIT: it actually works when adding the code in functions.php and omitting the changes in code WC files. Important: it only works when ONE attribute exists. However when there are 2 attributes (size & color for instance) then it doesn't work because it's not about out-of-stock variations anymore but about variation combinations, and indeed WooCommerce is completely clueless in this common scenario. Note that there seems to be no available plugin currently to address this very obvious problem

Get Cart products id on checkout WooCommerce page, to display product images

元气小坏坏 提交于 2019-12-17 18:45:21
问题 I'm using woocommerce on a site I'm working on and I want to display the current product thumbnail at the top of the checkout page, so the user could take a look at what his going to buy. However I can't find any way to do so. The closest I got, is to use WC::cart->get_cart() , but this outputs a list of all products. How can I achieve this? Thanks 回答1: Yes it's possible writing a custom function. To display those images at the beginning of checkout page just after your header's theme, use

Programmatically add Bundle Products in Magento, using the SKU / ID of Simple Items

大兔子大兔子 提交于 2019-12-17 18:30:21
问题 I have some simple catalog products in Magento, so I have their SKUs & IDs. Now I want to create a Bundled product using the array elements "bundle_options" & "bundle_selections" of the Bundle Items, which are used by the Magento Admin coding in its Observer Class. Also in the Observer class, there are method calls of two functions " setBundleOptionsData() " & " setBundleSelectionsData() ", for whose I am not able to find any function definition. Please any professional post here, because I

How to display Woocommerce product price by ID number on a custom page?

走远了吗. 提交于 2019-12-17 17:33:21
问题 I'm trying to display a price of a product in Woocommerce, on a custom page. There is a short code for that, but it gives product price and also adds an "Add to cart button", I don't want the button, i just want to get the price of a specific product by ID. Is this possible? Thanks. CODE: <table class="unlockTableBorder"> <tbody> <tr> <td> <h2>פתיחת מכשירי Alcatel כלל עולמי</h2> <h4>אנא קראו והבינו את תנאי השירות הבאים לפני הזמנת שירות זה:</h4> <ul> <li>שירות זה תומך בפתיחת מכשירים סלולריים

Changing the Add To Cart button text in WooCommerce for items with variations

戏子无情 提交于 2019-12-17 14:58:13
问题 I'm running WooCommerce version 2.5.5. The following lines of code don't seem to change the Add To Cart button text on my product page for an item with variations: add_filter('variable_add_to_cart_text', 'my_custom_cart_button_text'); function my_custom_cart_button_text() { return __('Buy Now', 'woocommerce'); } Would you happen to know what I'm missing? 回答1: The correct filter for the single product page is woocommerce_product_single_add_to_cart_text. function my_custom_cart_button_text(

Check if a customer has purchased a specific products in WooCommerce

余生颓废 提交于 2019-12-17 06:14:28
问题 I need to check if a customer has purchased a specific product earlier in WooCommerce. The case is this: The customer shall not be able to purchase product "c", "d", "e" unless they have purchased product "a" or "b" at an earlier time. If the customer has purchased product "a" or "b" earlier, then the purchase button of product "c", "d" and "e" is activated and they are allowed to buy them. If they haven´t purchased "a" or "b" earlier, they will not be allowed to purchase "c", "d", "e" and