Hey I am trying to build a shortcode for my order details on the order received page. The code below will generate the last result and then on top of it, it will display the word Array. My guess is that something in the foreach loop i am creating is still an array, but I dont know what to do
Tag: shortcode
How to add if and else condition in wordpress shortcode
I have a shortcode showing the username of the current user, it works. What I want to do is insert conditions. if the user has the username show it, otherwise show first name or something else. I searched on google and here on stack, I understood this is possible thanks to the if and else conditions but I’ve never done
How to fix php shortcode to show woocommerce download button
I am trying to view the download button belonging to the last order placed by a customer. Basically I have this code. It worked for other things like: displaying the purchase date, order total, product name etc, but it doesn’t work with the downlad. return $last_order->get_downloadable_items(); it shows the word array instead of the download button. Could someone tell me
How to put the woocommerce order date in a shortcode
I’m trying to put the date of the order placed on woocommerce in a shortcode. This is what I did: In the past this works, now for some reason it doesn’t. Am I doing something wrong ? Answer I found a solution after several attempts. I found that I was formatting the code wrong, consequently I wrote like this: I
Can’t get wordpress to stop making an additional HTML section?
hope everyone is having a wonderful afternoon! I have been developing a website, and have for the most part left with removing unused assets, and cleaning up the code. I have managed to remove most of the non-essential material, however I can’t get past understanding how and why does my HTML produces another separating , and I cannot find a
How to get WooCommerce product object in a custom shortcode to avoid errors
I have a function in which i am trying to get the product short description of the current product using the product id but i keep getting Uncaught Error: Call to a member function get_short_description() on bool in I have the following shortcode function where I am trying to get the product short description of the current WooCommerce product using
How to display sub field (image) with shortcode in WordPress?
These are the custom fields composition: 1 Group Footer 1.1 Group Col2 1.1.1 bbcimg (this is the image ID) 1.1.2 bbc-rss (this is the RSS feed ID) I have the following code displaying the bbc-rss: <…
Display related products using a shortcode on WooCommerce My account Dashboard
I’m trying to display related products in My account Dashboard page. I followed this WooCommerce Shortcodes documentation. I tried to use the following code: This does not display the related products. But when I try to display products in specific category like following, it works: Kindly any help to resolve this? Answer Note that related products shortcode need to be
Display WooCommerce Product Dimensions via a Shortcode
I am creating a custom layout (using Elementor) for a product – what I need is to have the dimensions of a product to display in a custom tab I have created. Is there a shortcode for product dimensions? (some of the products are variable too if that makes a difference) I have managed to get some code to display
Why does WooCommerce Order Shortcode Generate Plugin Notice on Custom Thank You Page?
I have created a re-direct to a custom “Thank You” (order-received) page in WooCommerce by using my child theme and functions.php. The re-direct works as intended and all other shortcodes that I have created works fine, except for this. When inserting my [order_cost_breakdown] shortcode using Gutenberg on my Thanks page and when placing on order, I get this notice: I