Woocommerce Archive Shortcode Loop

Hello!

My client’s website is https://www.deinboden.at

I’ve created an individual archive layout for my woocommerce products with cornerstone.
In Austria it is mandatory to show the price per unit to customers. The Plugin “Germanized” brings this feature to my shop.

To display the price per unit anywhere they have the following shortcode:
[gzd_product_unit_price]
The problem is that the shortcode will not be recognized by the product loop itself. As a result the price per unit of the 1st product in the archive is displayed at every other product.

Is it possible to make the shortcode functional for the loop?

Alternatively I’ve also found the right dynamic content key at “meta (custom fields)”:
{{dc:post:meta key="_unit_price"}}

The code works and brings me the right numbers but they are not formatted correctly. For instance the decimal separator is a point instead of a comma. (In Woocommerce backend the separator is set correctly as a comma). I’ve read in another thread, that it is not possible to format woocommerce price metakeys is that still the case?

Thanks in advance!

Hello Oliver,

Thanks for writing in!

Please use this format instead:
{{dc:post:meta key="_unit_price"}}/m<sup>2</sup>

If this is not working, we would love to check your archive layout. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
– Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

image

Best Regards.

Hi @ruenel,

thanks for taking care of my issue.

The code you gave me works in the looper but unfortunately the format is not correct. The problem is not to display the m2-unit, it’s the point as decimal separator instead of a comma at unit price itself.

As I wrote the decimal settings are set up correctly in woocommerce backend (thousand-separator is a point / decimal-separator is a comma).

Would be great if you can check this on the backend. The shortcode is still there too, if you have any ideas to get it into the loop correctly.

Thanks in advance!

Hello Oliver,

I cannot get passed the Authentication.

  • See the secure note below.

Meanwhile, please check your WooCommerce settings in WooCommerce > Settings > General > Currency Option. Make sure it is set to the correct currency and decimal points.

Best Regards.

Hello @ruenel!

The Login details are in a secure note to this post.

Thanks in advance!

Hi Oliver,

Unfortunately, the given credentials do not work for Site Authentication. Please check and reshare it.

Thanks

I tried to Login with the Username and Password form Secure Note and it worked properly. I’ve created another user you can find the data in this secure note.

Hi Oliver,

What you are giving is WordPress admin credentials, but as specified by my colleague we required the Site Authentication to reach the admin login page.

Thanks

Oh I’m sry I didn’t see the .htpasswd file on my Server. The Login data for it is in secure note. Please let me know if it’s working now. Thanks you!

Hey Oliver,

The given password is still not working. We cannot get passed this:

Please double-check. Thank you.

Hi @ruenel,

Please try it again now, I’ve changed some server-settings.
You should be able now to login in finally.

Sorry for the circumstances!

Hey Oliver,

I have checked your site already and I found out that the saved unit price (for the “Landhausdiele Test, gebürstet” as an example) is 61.37 which is why when using the post meta dynamic content, {{dc:post:meta key="_unit_price"}}, the decimal separator is a point.

This means that when using the post meta, the output is not formatted. At the moment, we do not have a WooCommerce Unit Price dynamic element. For now, you can just use the [gzd_product_unit_price] shortcode to get the correct formatted unit price. I will be adding this as a feature request so that there is easy access to the unit price and that it will be formatted with the correct separators.

Best Regards.

Hi @ruenel!

Thank you for checking the website and for adding it as a feature request.
There is also the same problem with “_unit” itself. The Squaremeter-Unit is also displayed as m2 instead of m². Maybe you can also include the units too.

Thank you and best regards

Hi Oliver,

Yes, we will include that too.

Cheers.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.