WooCommerce HTML after short description if product is in specific category

Woocommerce’s product categories are custom taxonomy terms, so you need to use the taxonomy functions (eg, has_term()) rather than WordPress’ category ones. function filter_woocommerce_short_description( $post_excerpt ) { global $post; if ( has_term( “term-name”, “product_cat”, $post->ID ) ) { $post_excerpt .= “<br/>” . “Test”; } return $post_excerpt; }; add_filter( ‘woocommerce_short_description’,’filter_woocommerce_short_description’,10, 1 );

Woocommerce checkout fields on the same line

Add custom CSS using custom style editor, for below classes and IDs .woocommerce-billing-fields__field-wrapper { display: flex; flex-wrap: wrap; } .woocommerce form .form-row { display: inline-block; } .woocommerce form .form-row input.input-text { max-width: 252px; } #billing_first_name_field { order: 1; } #billing_last_name_field { order: 2; } #billing_company_field { order: 3; } #billing_country_field { order: 4; } #billing_address_1_field … Read more

WordPress codex: apply_filters – clarification on creating a new hook on the fly. How do we use it?

How to use the filter single_product_archive_thumbnail_size I’ve searched for the tag single_product_archive_thumbnail_size in woocommerce repository on github. There is only the single occurrence of it as you see here. So how do we use it? The author’s of WooCommerce added this filter so that other developers would be able to modify the product’s archive thumbnail … Read more

How to remove recurring totals information for a particular subscription product? [closed]

Try filtering the hook woocommerce_cart_calculate_fees. Use this code. it might work for you. add_filter( ‘woocommerce_cart_calculate_fees’, ‘add_recurring_postage_fees’, 10, 1 ); function add_recurring_postage_fees( $cart ) { if ( ! empty( $cart->recurring_cart_key ) ) { remove_action( ‘woocommerce_cart_totals_after_order_total’, array( ‘WC_Subscriptions_Cart’, ‘display_recurring_totals’ ), 10 ); remove_action( ‘woocommerce_review_order_after_order_total’, array( ‘WC_Subscriptions_Cart’, ‘display_recurring_totals’ ), 10 ); } }

Migrate WooCommerce Orders [closed]

The reason copying those messed up your site was probably because of id mismatches. That is, posts with the ids of the stuff you’re importing already exists. Regardless, since woocommerce stores orders as a custom post type, your safest bet here is probably the built in wordpress post import/export tool. 1. In the wordpress backend … Read more

Woocommerce Membership Expiry Date

According to the documentation, wc_memberships_get_user_memberships() returns a list of WC_Memberships_User_Membership objects. The WC_Memberships_User_Membership class has a get_end_date() method that will return the expiry date. So you should be able to do something like this: // Get memberships for the current user. $memberships = wc_memberships_get_user_memberships(); // Verify that they have some memberships. if ( $memberships ) … Read more

How do I add a “Cancel” button on the subscriptions listing page [closed]

I was looking for the same thing but couldn’t find it anywhere so I tried to do it myself. Here’s my code by the way. Hope this helps. function addCancelButton($subscription) { $actions = wcs_get_all_user_actions_for_subscription( $subscription, get_current_user_id() ); if(!empty($actions)){ foreach ( $actions as $key => $action ){ if(strtolower($action[‘name’]) == “cancel”){ $cancelLink = esc_url( $action[‘url’] ); echo … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)