Set WooCommerce cart product count total to be divisible by number
…checkout. add_action( ‘woocommerce_check_cart_items’, ‘check_cart_items_conditionally’ ); /** * Check cart items conditionally displaying an error notice and avoiding checkout * @link https://stackoverflow.com/questions/65767078/disable-woocommerce-checkout-if-cart-items-count-is-not-a-multiple-of-n */ function check_cart_items_conditionally() { $multiple_of = 6; // <=…
Read MoreSort WooCommerce products from product category to be last in cart order
…to be last order in cart * @link https://stackoverflow.com/questions/65800801/sort-specific-product-category-cart-items-at-the-end-in-woocommerce */ function product_category_cart_items_sorted_end() { $category_terms = __(‘box’); // Here set your category terms (can be names, slugs or Ids) $items_in_category =…
Read MoreChanging the Modern Tribe Events Date Format
…output. https://gist.github.com/neilgee/d67ff7310441b680e1d0ad575994b330 It is a shortcode [all_the_single_dates] that outputs the dates like so …. 09 – 14 September 2018 28 October – 02 November 2018 17 October 2018 So ……
Read MoreCreate a WooCommerce Featured Products Loop of Featured Images
…backend of the WooCommerce products, ‘featured‘ it is a term that belongs to the taxonomy named ‘product_visibility‘. https://gist.github.com/neilgee/21cafcbb2037617158a56adb7b727a78 So in the above a shortcode is created; [woo_featured_products] ready…
Read MoreAdd Modern Tribe Event Categories as CSS classes in Event Posts
…in. add_filter( ‘body_class’, ‘cp_event_taxonomy_in_body_class’ ); // Ref – https://theeventscalendar.com/support/forums/topic/add-category-name-as-body_class/ // Add event categories terms to body class of event posts function cp_event_taxonomy_in_body_class( $classes ){ global $wp_query; $event_id = $wp_query->get_queried_object_id(); if…
Read MoreLimit the Words in WooCommerce Product Short Description
…any length to suit teasers, sliders etc and leave other areas where we want the full short description. https://gist.github.com/neilgee/c0834345db048429e3efb8ff47e3478d#file-get-shorty-php In the code snippet above we are using a conditional to…
Read MoreOutput Beaver Builder CPT Posts in a Module that belong to a Custom Taxonomy
…display from one taxonomy – this can be achieved in code using the fl_builder_loop_query_args filter. https://gist.github.com/neilgee/5b1584707cff899679235d62d4488c39 In the above code snippet – you need to ensure the BB Module has…
Read MoreOutput The Featured Image in a Loop as a Linked Media Image
Instead of linking a featured image to a post permalink in a loop – here is how you can link to its original image of itself. https://gist.github.com/neilgee/b5df702da5ef092b4cd48d57dec32768 So above, the…
Read MoreAdd Link to the Count in WooCommerce Product Category Menu
…count value of the products that belong to the particular term/product category, from line 105 – the link will go to the relevant archive page for that product category. https://gist.github.com/neilgee/480cd8b274e2995631216a21175554e9…
Read MoreOutput a Custom Taxonomy Archive by using Loop in WordPress
…a foreach loop. https://gist.github.com/neilgee/b60b7407c33307ccc539108e2cbc2a5a In the above, a custom taxonomy named custom_taxonomy_name is assigned to the variable array $terms and then used in a foreach loop to output as a…
Read More