Woocommerce Filter Products by Price widget – filter by price in custom field

I have products with price per package in eshop. I also created custom field with product price per square meters. Products are sold only by package not by square meters, but on archive page I need filtering products by price per square meters. I unregistered WC_Widget_Price_Filter widget and registered modified version of that widget, which displays correct min and max prices in square meters in filter slider. I modified function price_filter_post_clauses to display correct products. Function is located in includes/class-wc-query.php.

public function price_filter_post_clauses( $  args, $  wp_query ) {     global $  wpdb;      // phpcs:ignore WordPress.Security.NonceVerification.Recommended     if ( ! $  wp_query->is_main_query() || ( ! isset( $  _GET['max_price'] ) && ! isset( $  _GET['min_price'] ) ) ) {         return $  args;     }      // phpcs:disable WordPress.Security.NonceVerification.Recommended     $  current_min_price = isset( $  _GET['min_price'] ) ? floatval( wp_unslash( $  _GET['min_price'] ) ) : 0;     $  current_max_price = isset( $  _GET['max_price'] ) ? floatval( wp_unslash( $  _GET['max_price'] ) ) : PHP_INT_MAX;     // phpcs:enable WordPress.Security.NonceVerification.Recommended      /**      * Adjust if the store taxes are not displayed how they are stored.      * Kicks in when prices excluding tax are displayed including tax.      */     if ( wc_tax_enabled() && 'incl' === get_option( 'woocommerce_tax_display_shop' ) && ! wc_prices_include_tax() ) {         $  tax_class = apply_filters( 'woocommerce_price_filter_widget_tax_class', '' ); // Uses standard tax class.         $  tax_rates = WC_Tax::get_rates( $  tax_class );          if ( $  tax_rates ) {             $  current_min_price -= WC_Tax::get_tax_total( WC_Tax::calc_inclusive_tax( $  current_min_price, $  tax_rates ) );             $  current_max_price -= WC_Tax::get_tax_total( WC_Tax::calc_inclusive_tax( $  current_max_price, $  tax_rates ) );         }     }      $  args['join']   = $  this->append_product_sorting_table_join( $  args['join'] );     $  args['where'] .= $  wpdb->prepare(         ' AND wc_product_meta_lookup.min_price >= %f AND wc_product_meta_lookup.max_price <= %f ',         $  current_min_price,         $  current_max_price     );     return $  args; } 

I modified sql in $ args[‘join’] and $ args[‘where’]. Is it possible to modify this function without modifying it directly?

Price Tag for hiring a monster as mercenary?

I’m designing a game where players could hire "any" monster as a missionary and fight for him/her.

The only restriction is probably the alignments. After all, a CE monster will NEVER work for a LG character! Or rather, a LG character will never "hire" a CE monster! (All he/she want is kill the xxxx out of him/her/it!). And vice versa.

That’s all good! The only thing I can’t figure out is the "price"!

Apparently it should be based on their CR, but I really can’t figure out the math.

I want the player to hire higher-CR monsters as much opportunity as possible, but I don’t want it to be "too expensive"!

Otherwise the players could just hire whole bunch of low-CR monsters and zerg through everything, what’s the point of hiring any expensive high-CR monsters!?

And if it’s too "cheap", any "challenge" I put forth for them will be "too easy and meaningless"!

I know I could exploit the Leadership feat to put a "cap" on it, but at higher Leadership, the amount of low-level followers are in high double-digits and are in very good fit for the definition "Zerging"!

So I’m really at the end of my rope here, and I can’t find any alternative rules online talking about this. (Most of the things I found is "xxx discount on Amazon"! ~>3<~)

Could somebody PLEASE be so kind and help me out and guide me to the right way!?

Much appreciated!

How to increase price by 20% when value entered in SQL is VARCHAR

I am trying to increase the price of all items that are monitors by 20% but the current line is VARCHAR so when I try to increase by 20% I get the following error:

Msg 8114, Level 16, State 5, Line 1 Error converting data type varchar to numeric.

This was my data that I entered following steps on another post here

update Product set ProdPrice = ‘price * 1.2’ where ProdName like ‘%monitor%’

Here is what the full table looks like: enter image description here

How to modify the WooCommerce shop page to tweak the display price without affecting the actual price under the hood?

The woocommerce shop I am working on imports product price as "£ per g", this is correct for the calculation. On the shop page my client would like the price to be displayed as "£ per 100g" so I need to multiply the price by 100. In functions.php I have the following snippet which lets me change what is displayed (as you can see, I have already edited the text to display correctly), does anyone provide help on how to translate this import price to display price?

add_filter( 'woocommerce_get_price_html', 'wb_change_product_html' );     // Change and return $  price_html variable using the $  price and weight amount     let a = 10     function wb_change_product_html( $  price ) {         $  price_html = '<span class="amount">' . $  price . ' per 100g </span>';   // change weight measurement here              return $  price_html;     }          add_filter( 'woocommerce_cart_item_price', 'wb_change_product_price_cart' );     // Change the cart prices with $  price variable and weight amount     function wb_change_product_price_cart( $  price ) {         $  price = $  price . ' per g'; // change weight measurement here              return $  price;     } 

I’m sure that there’s a quick fix here! I have also added a screenshot of the import columns so that the price change I’m looking for can be seen.

enter image description here

Woocommerce for Money Transfer Site – displaying target price after conversion

I want to set up a site for a money transfer service using Woocommerce. I created a product and used a plugin to allow the customer set the price (the amount to be sent). I need to display the value of the destination currency after conversion. I wish to set the exchange rate manually.

Any advice?

Cozshopping.com Price Comparison Site and Shopping Search Engine

Why are you selling this site?
I need quick cash for emergency family reason

How is it monetized?
Affiliate programs (cj.com and shareasale.com) and also Amazon associates.

Does this site come with any social media accounts?

How much time does this site take to run?
Since 2015

What challenges are there with running this site?
Hosting fee. Cozshopping.com need good vps or dedicated server to run it to the max.

How to secure a price passed to a payment gateway on client?

Using Javascript, say a customer buy a product that cost 10$ .

Many payment gateways, like PayPal and Stripe, offer a client side Form where you input the sale data (price, amount, buyer address, etc), and it’s being sent to the gateway (e.g PayPal) from the client side.

But, at this point when i fill the form using Javascript on the client side, someone can change the price from 10 to 1 and pay only 1 to PayPal.

I know things has to be validated on my server, but validation means that the server is sending back to client a response saying this price is good or not good, but this respond can also be manipulated.

So how is it that companies allow client side payment anyway using a form ? How/where the actual sale data is being passed to the payment gateway ? client? server?

How to show price update date in product single page?

I wanted to show price update date in Woocommerce product single page after add to cart button. something like this: ” Price updated at 5/6/2020 “

I tried to research but I did not find a good response. Thanks for helping.

https://wordpress.stackexchange.com/a/216653/189455 this is also a good reference but I could not figure it out how to use and do what he said in code.