hook-woocommerce

Move product title above product image on Woocommerce archive pages

南笙酒味 提交于 2019-12-04 04:54:03
问题 I am trying to move the product title above the product image on the product archive page. I have managed to figure out how to move the information, but the price is moving above the image aswell. I want only the product title to be above the product image. The price should remain below, with the add to cart button etc. Here is my code snippet and screenshot of result so far: remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 ); add

How to get Pay Now URL with custom order status in WooCommerce?

萝らか妹 提交于 2019-12-03 21:49:25
I want to get the URL from where Customer can directly pay for their Invoice and also it should work with wc-cancelled and wc-transaction-declined ( custom order status ). My Solution What I'm doing now is created a custom page with my custom get parameters and processing the whole Payment Process as Documentation in Gateway provider Website. My Problem But the problem is whenever they update there doc file and plugin I also have to update my code; but if I get the Pay Now URL then WooCommerce and Gateway Plugin will take care of it. Is there a better solution? I got the solution in

Saving the value of a custom field phone number in WooCommerce My account > Account details

流过昼夜 提交于 2019-12-03 21:33:25
Trying to add a field for Woocommerce billing_phone to the my-account/edit-account/ . It is present within the update address pages but when adding to the form-edit-account.php it does not update. Currently adding by following the same code as the other fields, such as first_name : <input type="text" class="form-control woocommerce-Input woocommerce-Input--phone input-text" name="billing_phone" id="billing_phone" value="<?php echo esc_attr( $user->billing_phone ); ?>" /> Image of form with billing_phone being shown as a value: But upon updating with new number it is not changed … How can I

Add shortened description under the product title in WooCommerce archive pages

谁都会走 提交于 2019-12-03 17:31:28
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? 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 $product; // HERE define the number of words $limit = 10; $description = $product->get_description(); //

Display category and brand name on single product page

大城市里の小女人 提交于 2019-12-02 13:42:06
问题 In Woocommerce, I am using YITH WooCommerce Brands plugin to handle product brands. I'm currently struggling with a fixed text That I want under my short description in WooCommerce. I want to display dynamically the product name in that text (which works) , but also the product category name [CATEGORY_NAME] and brand name [BRAND_NAME] . But I can't seem to get those to work. Based on this answer thread: Add Text under Single Product Short Description in Woocommerce Here is my code version: //

WooCommerce Conversion Tracking Script for two Pixel

99封情书 提交于 2019-12-02 09:58:55
I want to promote my products by some affiliate networks. Do only thing you have to do, is to go into the function.php file and add this script with the pixel. With this script the tracking of the amount value works fine. This script works only for one network and if you are the only vendor. add_action( 'woocommerce_thankyou', 'my_custom_tracking' ); function my_custom_tracking( $order_id ) { $order = new WC_Order( $order_id ); $total = $order->get_subtotal(); $id = str_replace('#', '', $order->get_order_number()); echo '<iframe src="https://network.com/track?offer_id=666&amount=' . $total . '

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

Customize addresses fields on WooCommerce My account and Checkout

坚强是说给别人听的谎言 提交于 2019-12-02 07:34:14
问题 I'm using the woocommerce_checkout_fields filter to edit the value of woocommerce field labels. It works fine on the checkout page (as you might expect), however I cannot understand why it doesn't also take effect on the account pages. I thought these fields were still taken form the same place? More specifically, I'm talking about the address fields on the edit-address endpoint on woocommerce account pages? My code attempt: function custom_woocommerce_fields( $fields ) { // Billing Fields

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

Display category and brand name on single product page

回眸只為那壹抹淺笑 提交于 2019-12-02 06:22:59
In Woocommerce, I am using YITH WooCommerce Brands plugin to handle product brands. I'm currently struggling with a fixed text That I want under my short description in WooCommerce. I want to display dynamically the product name in that text (which works) , but also the product category name [CATEGORY_NAME] and brand name [BRAND_NAME] . But I can't seem to get those to work. Based on this answer thread: Add Text under Single Product Short Description in Woocommerce Here is my code version: // Add text after short description add_action( 'woocommerce_single_product_summary', 'custom_single