hook-woocommerce

Display only products from the logged in author on WooCommerce admin products list

戏子无情 提交于 2021-01-28 04:59:27
问题 Is there a way, by which this Admin product dashboard shows only the products created by the logged-in user? I am trying manage_{$post->post_type}_posts_custom_column function but cannot move much E.g. I want something like this add_action( 'manage_product_posts_custom_column', 'custom_column_content', 10, 2 ); function custom_column_content( $column, $product_id ){ if( logged in user==Product Author){ Display product; } else{ Dont display product } } 回答1: The manage_product_posts_custom

WooCommerce custom field in Orders edit page

主宰稳场 提交于 2021-01-28 04:22:24
问题 // Display custom field Orders edit page add_action('woocommerce_before_order_itemmeta', 'storage_location_of_order_items', 10, 3); function storage_location_of_order_items($item_id, $item, $product) { // Only on backend order edit pages if (!(is_admin() && $item->is_type('line_item'))) return; // Get your '_laoriiul' value (replace the slug by yours below) $custom_ladu = get_post_meta($product->get_id(), '_laoriiul', true); //Error message: "Uncaught Error: Call to a member function get_id()

Change WooCommerce order status based on approved status and specific order item

帅比萌擦擦* 提交于 2021-01-28 03:20:44
问题 I try to change a WooCommerce order status to "Processing" when the current status is "Approved" and the order includes a specific product ( id = 10). I have attempted the code below but it is not working. I am quite new to php and would appreciate any guidance! add_action('woocommerce_order_status_changed', 'ts_auto_complete_business_cards'); function ts_auto_complete_business_cards($order_id) { if ( ! $order_id ) { return; } global $product; $order = wc_get_order( $order_id ); if ($order-

Remove some hooked functions based on virtual products in WooCommerce Checkout

允我心安 提交于 2021-01-28 02:00:56
问题 I want to remove some information on checkout page when there is only virtual products in cart. The following is removing what I want on checkout page: remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_checkout_privacy_policy_text', 20 ); remove_action( 'woocommerce_checkout_terms_and_conditions', 'wc_terms_and_conditions_page_content', 30 ); remove_action( 'woocommerce_checkout_terms_and_conditions', 'woocontracts_terms_fields', ); remove_action( 'woocommerce_before_checkout

Move product description after short description in Woocommerce

Deadly 提交于 2021-01-27 20:20:18
问题 I've used the first option of this hook (the other ones didn't work) -> Woocommerce Product Default Description for All Products And this is how it looks (the red marked text is the standard description) However, I want the text to appear after the product description. where the red arrow is, I want the standard text. So above 'in winkelmand' (which means 'add to bag') How can I achieve this? 回答1: This can be done with the following code (commented) : // 1. Remove the description product tab

Adding a custom button after add to cart button in single product pages

孤者浪人 提交于 2021-01-27 14:09:37
问题 I am developing an ecommerce store based on WooCommerce. I would like to add an View Cart Below the Add To Cart Button. It would be even better if it could only shown after adding at least 1 item in the cart successfully: //add view cart button after add to cart button add_action('woocommerce_after_add_to_cart_button','view_cart_store'); function view_cart_store() { ?> <a class="button wc-forward" href="https://example.xxx/cart/"><?php _e( 'View Shopping Cart', 'woocommerce' ) ?></a> <?php }

Woocommerce Show only one price for variable product on discount

喜欢而已 提交于 2021-01-23 05:14:04
问题 Here is my WooCommerce website: sweetworldcandy.com The issue is, in variable product price the least and the max value is showing what I want is if the product is not on sale show the least value if it is on sale show the least value and the least value of offer price by adding a slash as delete tag I shared this three images below for reference: 回答1: 2020 Update (for Woocommerce 3+) Replaced deprecated function woocommerce_price() by wc_price() since Woocommerce 3+: add_filter('woocommerce

Woocommerce Show only one price for variable product on discount

混江龙づ霸主 提交于 2021-01-23 05:11:47
问题 Here is my WooCommerce website: sweetworldcandy.com The issue is, in variable product price the least and the max value is showing what I want is if the product is not on sale show the least value if it is on sale show the least value and the least value of offer price by adding a slash as delete tag I shared this three images below for reference: 回答1: 2020 Update (for Woocommerce 3+) Replaced deprecated function woocommerce_price() by wc_price() since Woocommerce 3+: add_filter('woocommerce

Woocommerce checkout custom select field

纵饮孤独 提交于 2021-01-21 10:12:05
问题 I have the following function adding a select list to the woo-commerce checkout form: woocommerce_form_field( 'airport_pickup', array( 'type' => 'select', 'class' => array('airport_pickup form-row-wide'), 'label' => __('Would you like us to arrange transportation from the airport to your starting hotel?'), 'required' => true, 'options' => array( 'Y' => __('YES'), 'N' => __('NO') )), $checkout->get_value( 'airport_pickup' )); I would like to make the 'NO' option selected by default.Please

Woocommerce checkout custom select field

你。 提交于 2021-01-21 10:08:03
问题 I have the following function adding a select list to the woo-commerce checkout form: woocommerce_form_field( 'airport_pickup', array( 'type' => 'select', 'class' => array('airport_pickup form-row-wide'), 'label' => __('Would you like us to arrange transportation from the airport to your starting hotel?'), 'required' => true, 'options' => array( 'Y' => __('YES'), 'N' => __('NO') )), $checkout->get_value( 'airport_pickup' )); I would like to make the 'NO' option selected by default.Please