Comments on: [wcj_order_meta] https://booster.io/shortcodes/wcj_order_meta/ WordPress WooCommerce Plugin Thu, 09 May 2024 06:22:57 +0000 hourly 1 https://wordpress.org/?v=6.7.2 By: RokasJ https://booster.io/shortcodes/wcj_order_meta/#comment-68114 Mon, 30 Dec 2019 10:00:55 +0000 https://booster.io/?p=4129#comment-68114 In reply to Alejandro.

Hi,

In this case you could add multiple shortcodes to the template, as they are not going to be shown unless the meta for that key exists. We have also added a shortcode to display all order meta information to our todo list.

Best regards,
Rokas – Support Team

]]>
By: Alejandro https://booster.io/shortcodes/wcj_order_meta/#comment-67497 Tue, 24 Dec 2019 17:59:19 +0000 https://booster.io/?p=4129#comment-67497 In my case I create the meta-keys manually and they are always dynamic.
This short code should be able to have an option that shows all the meta-key of the order. I am using PDF creation and I need it to show that detail of my service sold.
I’m disappointed, I will have to use another plugin that goes around “WooCommerce PDF Invoices & Packing Slips”

]]>
By: Cecil https://booster.io/shortcodes/wcj_order_meta/#comment-40496 Sat, 25 May 2019 18:42:05 +0000 https://booster.io/?p=4129#comment-40496 In reply to Bill Edmundson.

Medman,

I’ve only used the output from the php code above in one place -on custom thank you pages created with “Woocommerce Thank You Page – Nextmove”. To show the results, I have inserted the shortcodes I created with the php code with passed parameters as shown below:

[booster_pay_fee meta_id=”_order_wcj_checkout_field_2″]
[booster_anon meta_id=”_order_wcj_checkout_field_1″]

There is probably a method to insert the shortcodes into the pdf template file.

Hope this helps.

]]>
By: MedMan Creative https://booster.io/shortcodes/wcj_order_meta/#comment-40348 Wed, 22 May 2019 16:04:23 +0000 https://booster.io/?p=4129#comment-40348 In reply to Bill Edmundson.

Hi Cecil
Thanks for posting this code. I am just now getting back to this issue.
I inserted the code into the functions.php (and customized the names of the fields to fit my application), but then when I attempt to load the PDF of the invoice where the Yes/No should output, I get a ‘This page isn’t working’ error.
Did you add one of the newly created shortcodes to the template file as well?

I had added this code to my invoice template and it outputs the custom fields but not the answer.

custom_field(‘_billing_wcj_checkout_field_1’); ?>

custom_field(‘_billing_wcj_checkout_field_2’); ?>

I altered your code to this:
// Display Yes or No for Booster single checkbox field – Sign up for Newsletter
add_shortcode(‘booster_newsletter’, ‘generate_newsletter’);
function generate_newsletter($atts) {
// Get the shortcode value and do the transform
$checkbox_value = do_shortcode(‘[wcj_billing_meta meta_key=”_billing_wcj_checkout_field_2″]’);

if ( $checkbox_value == 0 ) {
$output = “No”
}
else {
$output = “Yes”
}

return $output;
}

// Display Yes or No for Booster single checkbox field – Is this a gift
add_shortcode(‘booster_gift’, ‘generate_gift’);
function generate_gift($atts) {
// Get the shortcode value and do the transform
$checkbox_value = do_shortcode(‘[wcj_billing_meta meta_key=”_billing_wcj_checkout_field_1″]’);

if ( $checkbox_value == 0 ) {
$output = “No”
}
else {
$output = “Yes”
}

return $output;
}

]]>
By: Cecil Bordages https://booster.io/shortcodes/wcj_order_meta/#comment-39066 Tue, 30 Apr 2019 21:23:48 +0000 https://booster.io/?p=4129#comment-39066 In reply to Bill Edmundson.

I’m not a PHP programmer, but I was able to kludge this code together after some research. I’m sure a real programmer could suggest something better…but it works. You put the newly created short code where you want the Yes/No answer to appear. These are the two snippets of PHP I have added to the functions.php file in my child theme folder. Always create a child theme before editing your functions.php file.

// Display Yes or No for Booster single checkbox field – Pay Processing Fee
add_shortcode(‘booster_pay_fee’, ‘generate_pay_fee’);
function generate_pay_fee($atts) {
// Get the shortcode value and do the transform
$checkbox_value = do_shortcode(‘[wcj_order_meta meta_key="_order_wcj_checkout_field_2"]‘);

if ( $checkbox_value == 0 ) {
$output = “No”;
}
else {
$output = “Yes”;
}

return $output;
}

// Display Yes or No for Booster single checkbox field – Anonymous Donation
add_shortcode(‘booster_anon’, ‘generate_anon’);
function generate_anon($atts) {
// Get the shortcode value and do the transform
$checkbox_value = do_shortcode(‘[wcj_order_meta meta_key="_order_wcj_checkout_field_1"]‘);

if ( $checkbox_value == 0 ) {
$output = “No”;
}
else {
$output = “Yes”;
}

return $output;
}

]]>
By: Bill Edmundson https://booster.io/shortcodes/wcj_order_meta/#comment-39064 Tue, 30 Apr 2019 21:14:08 +0000 https://booster.io/?p=4129#comment-39064 Hello Cecil
I am having the same situation and would love to see the php code you used to accomplish adding Yes and No.
Would you be so kind as to share?

Thanks
Bill

]]>
By: Cecil https://booster.io/shortcodes/wcj_order_meta/#comment-33636 Fri, 18 Jan 2019 03:58:50 +0000 https://booster.io/?p=4129#comment-33636 In reply to bordages.

Sorry about the typo on 2 rather than 0.

I was able to use some basic PHP to create a custom shortcode for the two checkbox fields I added to output “Yes” or “No” depending on the value your shortcode returned.

]]>
By: RokasJ https://booster.io/shortcodes/wcj_order_meta/#comment-33602 Thu, 17 Jan 2019 13:04:36 +0000 https://booster.io/?p=4129#comment-33602 In reply to bordages.

Hi,

Values should be “0” or “1” but not “2”. This is because checkbox meta is saved as a boolean type which can only be those 2 values. Unfortunately it is not possible to change that yet.

Best regards,
Rokas – Support Team

]]>
By: bordages https://booster.io/shortcodes/wcj_order_meta/#comment-33571 Wed, 16 Jan 2019 23:35:26 +0000 https://booster.io/?p=4129#comment-33571 When using this shortcode with a Single checkbox field, it returns a value of “1” or “2” rather than the expected “Yes” or “No”.

]]>
By: Ibrahim Jaber https://booster.io/shortcodes/wcj_order_meta/#comment-23537 Thu, 24 May 2018 03:13:16 +0000 https://booster.io/?p=4129#comment-23537 The meta shows the contents but HTML’s get filtered out.

]]>