Hide products linked to a Membership while having that certain membership in Woocommerce

I have 2 Woocommerce Subscription Products called:

  • Bronze Membership (Monthly Subscription linked to a "Bronze Membership" in Woocommerce Memberships)
  • Silver Membership (Monthly Subscription linked to a "Silver Membership" in Woocommerce Memberships)

I can restrict products to these memberships with no problem, but in case of one customer purchase the Bronze Membership Subscription, when he goes to my store, he can’t see the Bronze Membership but he can see the Silver one., and if he has the Silver one, he can’t see the silver one but can see the bronze one in case he wants to downgrade his sub.

Isn’t there a way to hide the membership subscription product if the customer has an active membership?

WooCommerce products sorting by primary category first

I have a site with woocommerce and yoast seo plugin. I want to list the products on category archive page, by making the products of primary category (from yoast plugin) come first. Currently it does not do that. It is listing the products randomly or by menu order. The products have multiple categories assigned. For ex. the page of ‘Fashion’ category archive should list the products with primary category ‘Fashion’ to come first. Thanks

Retrieve total of products ordered for each customer from WooCommerce “wc_order_product_lookup” table

I want to retrieve the sum of all products ever ordered by customer using the "customer id". enter image description here

And I want to display it in a table on a new wordpress page, kinda like this. Basically SELECT SUM(product_qty) FROM wc_order_product_lookup for each customer and show it in a table, like the one designed in paint. Thank you to anyone that will take the time to reply to this. enter image description here

Applying replacement rules to products doesn’t work as expected

I have the following issue: I’d like to apply some replacement rules, for example

rules:={f[x]/t :> ff[x], g[x]/t :> gg[x]} 

to an expression, e.g. like this:

(f[x]*g[x]/(t^2))/. rules 

Surprisingly, this doesn’t give the expected result


How do I fix this? Sorry if it’s an easy question, I’m still a beginner with Mathematica.

Operator products summing

Is there a way to perform the below summation in Mathematica?

$ $ \frac{\left(\hat{X}_{ij}+i\delta_{ij}\right)}{i}\frac{\left(\hat{X}_{kl}+i\delta_{kl}\right)}{i}$ $

I am finding the issue because order matters here. X is operator. So it’s order is important. g and X are antisymmetric tensors. The answer to the above equation I am expecting is:

$ $ -\sum_{i,j,k,l}\left(g_{ijkl}\hat{X}_{ij}\hat{X}_{kl}+ig_{ijkl}\hat{X}_{ij}\delta_{kl}+ig_{ijkl}\delta_{ij}\hat{X}_{kl}-g_{ijkl}\delta_{ij}\delta_{kl}\right)$ $ $ $ =-\sum_{i,j,k,l}g_{ijkl}\hat{X}_{ij}\hat{X}_{kl}$ $

Can I implement this using the following code:

SumHeld /: MakeBoxes[SumHeld[expr_, ranges__], form_] :=   MakeBoxes[Sum[expr, ranges], form]  SumHeld /:    SyntaxInformation[    SumHeld] = {"LocalVariables" -> {"Table", {2, Infinity}}}; SumHeld /: c_?NumericQ SumHeld[rest_, range__] :=   SumHeld[c rest, range] IndexUnify[HoldPattern@Plus[sums : SumHeld[_, __] ..]] :=   Plus @@ With[{targetIndices = List @@ #[[-1, 2 ;;, 1]],        sourceIndicesList = List @@@ #[[;; , 2 ;;, 1]]},       Function[{sum, sourceIndices},         sum /. Thread[          sourceIndices ->            Take[targetIndices, Length@sourceIndices]]] @@@        Transpose@{#, sourceIndicesList}] &@   SortBy[Flatten /@ {sums}, Length]  SumTogether[HoldPattern@Plus[sums : SumHeld[_, sameRanges__] ..]] :=   SumHeld[Plus @@ {sums}[[;; , 1]], sameRanges] SumTogether[HoldPattern@Plus[sums : SumHeld[_, __] ..]] /;    UnsameQ @@ {sums}[[;; , 2 ;;]] :=   Plus @@ SumTogether@*Plus @@@ GatherBy[{sums}, Rest]  SumHeld[expr_, {lst_List,     dim_}] := (term |->      SumHeld[term,       Sequence @@        Table[If[Count[term, patt, \[Infinity]] == 2, {patt, dim},          Nothing], {patt, lst}]]) /@ expr 

How to modify the above code to incorporate to handle operators?

Woocommerce sale flash badge not showing in products page [closed]

the problem that I have is this. I am just helping someone with their woocommerce/wordpress website, I am not very experienced with it but they need some urgent help. Basically, they want to show a badge whenever a product is on sale. I just found the way to do it and it is working fine, but only in the single product page. In the page of a single product, in the related products it shows the badge in the discounted products. But in the general products page it does not show anything. This is the code I got for the single product pages:

function sales_badge( $  text, $  post, $  product ) {         return $  tagType = '<span class="onsale"><img style="max-width: 150px;" src="sale.jpg"></span>'; } add_filter('woocommerce_sale_flash', 'sales_badge', 99, 3 );  

For the theme we are using: Astra and Elementor. I have tried everything and in google but could not find anything related with this. FYI: we are not using any plugin for this and we do not plan to.

How to display products sort by Tags for Woocommerce

I have tried to display products by tags on shop page, i found this code and it workes perfectly

            $  args = array(                 'number'     => $  number,                 'orderby'    => 'title',                 'order'      => 'ASC',                 'hide_empty' => $  hide_empty,                 'include'    => $  ids             );             $  product_tags = get_terms( 'product_tag', $  args );             $  count = count($  product_tags);             if ( $  count > 0 ){                 foreach ( $  product_tags as $  product_tag ) {                     echo '<h4>' . $  product_tag->name . '</a></h4>';                     $  args = array(                         'posts_per_page' => -1,                         'tax_query' => array(                             'relation' => 'AND',                             array(                                 'taxonomy' => 'product_tag',                                 'field' => 'slug',                                 // 'terms' => 'white-wines'                                 'terms' => $  product_tag->slug,                                 'product_tag'=> "latest-product"                             )                         ),                         'post_type' => 'product',                         'orderby' => 'title,'                     );                     $  products = new WP_Query( $  args );                     woocommerce_product_loop_start();                     while ( $  products->have_posts() ) {                         $  products->the_post();                         do_action( 'woocommerce_shop_loop' );                         wc_get_template_part( 'content', 'product' );                         ?>                                                      <?php                     }                     woocommerce_product_loop_end();                 }             }          ?> 

But when I tried to filter resaults it wont apply filters, by the way i m using Annasta Filter Plugin


What kinds of Metallic Dragons were ever shown in D&D products? [closed]

Everyone knows the iconic metallic dragons that come in almost every single core monster book, Gold, Silver, Bronze, Copper, Brass. Let’s call those the “core five”

There were some others, like dunno Steel, Iron, Platinum, Electrum, Uranium(?), and what else…

What kinds of metallic dragons other than the “core five” were shown in D&D products?
What were their ecologies and demeanors?
In what worlds did they debut/existed?