hook-woocommerce

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

…衆ロ難τιáo~ 提交于 2019-12-04 17:07:06
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">'; woocommerce_wp_text_input( array( // Text Field type 'id' => '_Stan', 'label' => __( 'Stan',

Move Amazon Button on Woocommerce Checkout Page

爱⌒轻易说出口 提交于 2019-12-04 16:59:31
I need to move the Amazon Pay message/button on the checkout page in Woocommerce. We are using Amazon Pay by Woocommerce . When I look at the plugin code I have determined that in the plugin's file /woocommerce-gateway-amazon-payments-advanced.php the message/button gets added using: add_action( 'woocommerce_before_checkout_form', array( $this, 'checkout_message' ), 5 ); If I change 'woocommerce_before_checkout_form' to 'woocommerce_after_checkout_form' it moves. I have been struggling to figure out how to hook into the plugin from my functions.php. The following worked for me: function move

How to add Variations tab in custom product type in Woocommerce?

白昼怎懂夜的黑 提交于 2019-12-04 14:45:57
I've installed a plugin for "Gift Cards", which is basically adding a product type "Gift card". I need to enhance its functionality. There are other tabs available for this but the tab "Variations" is not. How can i add this tab so my custom product type can also behave like a variable product. Screen Shot: http://prntscr.com/ekogwd And i've to use my custom product type strictly means i cannot change it to variable product type. Is there any hook, action, or filter to add this tab manually to my custom product type "Gift card" using woocommerce? I assume you've already added the Gift Card to

Adding a hidden fields to checkout and process it through order

戏子无情 提交于 2019-12-04 12:20:37
I would like to add an verification code to the checkout process that is read-only ( or invisible) and pre-filled, pinned on an order. The Customer Need this Code to verifiy the Order. I add a custom Array to the Billing Field at the woocommerce_checkout_fields filter: //VID $fields['billing']['billing_vid'] = array( 'label' => __('', 'woocommerce'), 'placeholder' => _x('', 'placeholder', 'woocommerce'), 'required' => false, 'type' => 'text', 'class' => array('form-row-wide'), 'clear' => false, 'default' => wp_rand(10000,99999) ); This works, but the Customer still can write Content in the

Add coupon to the processing order email only if the customer have not used one

孤街醉人 提交于 2019-12-04 11:13:45
I came across this snippet that adds a coupon to the order mail. I would like to make it appear in the processing order mail only if the customer have not used any coupon. add_action( 'woocommerce_email_before_order_table', 'add_content', 20 ); function add_content() { echo '<h2 id="h2thanks">Get 20% off</h2><p id="pthanks">Thank you for making this purchase! Come back and use the code "<strong>Back4More</strong>" to receive a 20% discount on your next purchase! Click here to continue shopping.</p>'; } Thanks. @update 2: New orders are most of the time in 'on-hold' status, but not in

Add custom content to WooCommerce product description

好久不见. 提交于 2019-12-04 09:06:09
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 the last line in the description The code i have for injecting text before short description is this: add

Adding custom attribute to WooCommerce shop loop product title

橙三吉。 提交于 2019-12-04 06:39:51
问题 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

How to create multiple simple-products with same SKU in WooCommerce?

China☆狼群 提交于 2019-12-04 05:58:20
I want to create multiple simple-product with same SKU in WooCommerce. I search in admin settings but there I cannot find any settings to enable this features. Is there any hook so I can disable this features. If you want to completely disable the SKU feature then you have to use wc_product_sku_enabled filter. It will remove the SKU field from both backend and frontend. add_filter( 'wc_product_sku_enabled', '__return_false' ); If you want to keep the SKU feature but need to disable unique SKU check then you have to use wc_product_has_unique_sku filter. It will keep the SKU field in both

Woocommerce variation dropdown option tag add some dataset

一曲冷凌霜 提交于 2019-12-04 05:30:56
问题 <select class="license_type" name="license_type" id="license_type"> <option value="license" data-set="500">Single Site License</option> <option value="license" data-set="700">5 Site License</option> <option value="license" data-set="1400">Developers License</option> </select> In the woocommerce variation product - I want to add some data-set tags in option tag. data-set="<? php some code here to pull the price of the variation ?>" Is that possible through hook/filter. 回答1: function get_price

Add the product image to Woocommerce my account order view

安稳与你 提交于 2019-12-04 04:56:29
问题 I would like to add image on my account view order pages in Woocommerce.some one I am able to get the image but the size is too large and I don't know where I need to add this code: <?php // Get a list of all items that belong to the order $products = $order->get_items(); // Loop through the items and get the product image foreach( $products as $product ) { $product_obj = new WC_Product( $product["product_id"] ); echo $product_obj->get_image(); } ?> Any help will be appreciated Here is the