Field Groups not showing
-
Hi there, thank you for a great plugin.
We are unable to edit Field Groups as they are not showing in the admin backend. However one can see the items on the product front-end.
The field is appended to a Simple product, but using Product Open Pricing (Name Your Price) for WooCommerce to allow a custom price.
This plugin was implemented on the site on 23 November 2023 in order to guide purchasers, but we are now unable to edit the field.
Thank you in advance
The page I need help with: [log in to see the link]
-
Hi @charlespage
Product fields can also be created on the product itself. Edit your product and then check the “custom fields” tab.Thank you for your prompt reply.
In the Product data there is a Custom fields tab, and in there the Fields?(Add some custom fields to this group) and Layout (Field group layout settings) entries are blank.
I am seeing a console error:
jQuery.Deferred exception: jQuery(…).sortable is not a function TypeError: jQuery(…).sortable is not a function
at new e (https://thewinecentre.co.za/wp-content/plugins/advanced-product-fields-for-woocommerce/assets/js/admin.min.js:18:7892)
at HTMLDocument. (https://thewinecentre.co.za/wp-content/plugins/advanced-product-fields-for-woocommerce/assets/js/admin.min.js:18:8013)
Could this be related?
Thanks
CharlesYes, that error is preventing the fields that are there from showing. Can you send us the following info:
1) Which theme (plus which version) are you using?
2) Using any custom code?
3) A list of your active plugins.
4) Which WordPress and Woo version are you using.Thank you, here you go. The custom code is at the end
Theme: OceanWP Version: 3.5.3
WordPress: 6.4.2
WooCommerce: 8.4.0
Active Plugins:
- ManageWP – Worker?by GoDaddy – 4.9.18
- Pay For Post with WooCommerce Premium?by Pramadillo – 3.1.17
- Advanced Product Fields for WooCommerce?by StudioWombat – 1.6.6
- Anywhere Elementor?by WPVibes – 1.2.9
- Disable Comments?by WPDeveloper – 2.4.5
- Duplicate Menu?by Jonathan Christopher – 0.2.2
- Duplicate Page?by mndpsingh287 – 4.5.3Dynamic Cart Messages for WooCommerce?by SaffireTech – 1.0.7
- Elementor Pro?by Elementor.com – 3.18.2
- Elementor?by Elementor.com – 3.18.3
- Essential Addons for Elementor?by WPDeveloper – 5.9.3
- Final Tiles Grid Gallery – Image Gallery?by WPChill – 3.5.8
- Smash Balloon Instagram Feed?by Smash Balloon – 6.2.7Make Connector?by Celonis s.r.o. – 1.5.8
- JetElements For Elementor?by Crocoblock – 2.6.14
- JetEngine?by Crocoblock – 3.3.3
- Kadence WooCommerce Email Designer?by Kadence WP – 1.5.12
- Login as User?by Web357 – 1.4.8
- Mailchimp for WooCommerce?by Mailchimp – 3.5
- MC4WP: Mailchimp for WordPress?by ibericode – 4.9.10
- Nextend Social Login?by Nextendweb – 3.1.11
- Nextend Social Login Pro Addon?by Nextendweb – 3.1.11
- Ocean Custom Sidebar?by OceanWP – 1.1.2
- Ocean Extra?by OceanWP – 2.2.4
- Ocean Product Sharing?by OceanWP – 2.0.8
- Ocean Social Sharing?by OceanWP – 2.0.6
- Ocean Stick Anything?by OceanWP – 2.0.7
- Product Open Pricing (Name Your Price) for WooCommerce?by WP Wham – 1.7.1
- PW WooCommerce Gift Cards?by Pimwick, LLC – 1.251
- QSM – MailChimp Integration?by QSM Team – 1.3.0
- Quiz And Survey Master?by ExpressTech – 8.2.0
- Rank Math SEO?by Rank Math – 1.0.210
- Elementor Hero Slider?by Pixel+ – 1.0.3
- Smart Manager – WooCommerce Advanced Bulk Edit, Inventory Management & more…?by StoreApps – 8.27.0
- Tawk.to Live Chat?by Tawkto – 0.8.2
- WooCommerce Product Table PRO?by WC Product Table – 3.2.0
- WooCommerce Variation Custom Fields?by Kartik Gahlaut – 1.0.0
- WebP Express?by Bj?rn Rosell – 0.25.8Woo Custom Emails Per Product?by Alex Mustin – 2.2.9
- WooCommerce Payfast Gateway?by WooCommerce – 1.6.0
- WooCommerce?by Automattic – 8.4.0
- Wordfence Security?by Wordfence – 7.11.1
- WordPress Importer?by wordpressdotorg – 0.8.1
- WP Activity Log for WooCommerce?by Melapress – 1.5.2
- WP Review Slider?by LJ Apps – 13.1
- WP Rocket?by WP Media – 3.15.6
- WP Rollback?by WP Rollback – 2.0.4
- WP Activity Log (Premium)?by WP White Security – 4.5.2
- WP Hardening?by Astra Security – 1.2.6
add_action( 'wp_enqueue_scripts', 'oceanwp_child_enqueue_parent_style' ); // Part 1 // Edit Single Product Page Add to Cart Button add_filter( 'woocommerce_product_single_add_to_cart_text', 'custom_add_to_cart_single_product' ); function custom_add_to_cart_single_product() { global $product; if ( has_term( array('wset-wine-courses', 'wset-wine-courses-online'), 'product_cat', $product->ID ) ) { return 'Book Now'; } else { return 'Add to Cart'; } } // Part 2 // Edit Archive Pages Add to Cart Buttons add_filter( 'woocommerce_product_add_to_cart_text', 'archive_custom_cart_button_text' ); function archive_custom_cart_button_text() { global $product; if ( has_term( array('wset-wine-courses', 'wset-wine-courses-online'), 'product_cat', $product->ID ) ) { return 'Book Now'; } else { return 'Add to Cart'; } } add_filter( 'woocommerce_product_tabs', 'remove_product_tabs', 9999 ); function remove_product_tabs( $tabs ) { unset( $tabs['additional_information'] ); return $tabs; } //hide nag in wp-admin for Smart Manager add_action('admin_head', 'my_custom_fonts'); function my_custom_fonts() { echo '<style> .sm_design_notice {display:none !important; } #dup_sm_editor_grid, #add_sm_editor_grid {display:none !important; } </style>'; } /** * Display field value on the order edit page */ function md_custom_woocommerce_checkout_fields( $fields ) { $fields['order']['order_comments']['placeholder'] = 'Order Notes / Reason for Payment'; $fields['order']['order_comments']['label'] = 'Order Notes / Reason for Payment'; return $fields; } add_filter( 'woocommerce_checkout_fields', 'md_custom_woocommerce_checkout_fields' ); /* ******************* Add dob on WooCommerce checkout page. */ add_action( 'woocommerce_after_checkout_billing_form', 'display_extra_fields_after_billing_address' , 10, 1 ); function display_extra_fields_after_billing_address () { _e( "Date of Birth <span style='color:red;'>*</span>", "add_extra_fields"); ?> <br> <input type="date" name="add_dob" class="add_dob"> <script> jQuery(document).ready(function($) { $(".add_dob").datepicker({ minDate: 0, }); }); </script> <br> <?php _e( "Where did you hear about us? <span style='color:red;'>*</span>", "add_extra_fields"); ?> <br> <select name="heardaboutus" id="heardaboutus"> <option value="">- Select - </option> <option value="The Wine-ish Team">The Wine-ish Team</option> <option value="Google Search">Google Search</option> <option value="Social Media">Social Media</option> <option value="Personal Recommendation">Personal Recommendation</option> <option value="Woolies">Woolworths</option> </select> <?php } add_filter( 'woocommerce_email_order_meta_fields', 'custom_woocommerce_email_order_meta_fields', 10, 3 ); function custom_woocommerce_email_order_meta_fields( $fields, $sent_to_admin, $order ) { $fields['hear_about_us'] = array( 'label' => __( 'Hear About Us' ), 'value' => get_post_meta( $order->id, '_heardaboutus', true ), ); return $fields; } add_action( 'woocommerce_checkout_update_order_meta', 'add_order_dob_to_order' , 10, 1); function add_order_dob_to_order ( $order_id ) { if ( isset( $_POST ['add_dob'] ) && '' != $_POST ['add_dob'] ) { add_post_meta( $order_id, '_dob', sanitize_text_field( $_POST ['add_dob'] ) ); } if ( isset( $_POST ['heardaboutus'] ) && '' != $_POST ['heardaboutus'] ) { add_post_meta( $order_id, '_heardaboutus', sanitize_text_field( $_POST ['heardaboutus'] ) ); } } add_action('woocommerce_checkout_process', 'customised_checkout_field_process'); function customised_checkout_field_process() { // Show an error message if the field is not set. if (!$_POST['add_dob']) wc_add_notice(__('<strong>Date of Birth</strong> is a required field.') , 'error'); if (!$_POST['heardaboutus']) wc_add_notice(__('<strong>Where you heard about us from</strong> is a required field.') , 'error'); } add_filter( 'woocommerce_order_item_permalink', '__return_false' ); add_filter('wc_pay_per_post_my_account_show_purchased', '__return_false'); add_filter('wc_pay_per_post_my_account_show_has_access', '__return_true'); add_filter('wc_pay_per_post_args', 'my_theme_wc_ppp_args'); function my_theme_wc_ppp_args($args){ $args['orderby'] = 'menu_order'; $args['order'] = 'asc' ; return $args; } add_filter( 'woocommerce_thankyou_order_received_text', 'av_thank_you' ); function av_thank_you() { $added_text = '<p>Thank you. Your order has been received and is now being processed. Your order details are shown below for your reference</p>'; return $added_text ; } add_filter( 'woocommerce_get_order_item_totals', 'remove_subtotal_from_orders_total_lines', 100, 1 ); function remove_subtotal_from_orders_total_lines( $totals ) { unset($totals['cart_subtotal'] ); return $totals; } /** * Set the proper resource payload for a custom action webhook * * @param int $target_webhook_id * @param string $desired_resource 'order', 'product', 'coupon', or 'customer' */ function set_resource_for_webhook_payload_by_webhook_id($target_webhook_id, $desired_resource) { //set the desired_resource payload for this webhook ('order', 'product', 'coupon', 'customer') add_filter('woocommerce_webhook_resource', function($resource, $webhook_id) use ($target_webhook_id, $desired_resource) { if($webhook_id == $target_webhook_id) { return $desired_resource; } return $resource; }, 10, 2); //need to ensure our event (i.e., action) is seen as valid, as we've changed the default 'action.' prefix for the topic above add_filter('woocommerce_valid_webhook_events', function($valid_events) use ($target_webhook_id) { try { $topic = wc_get_webhook($target_webhook_id)->get_topic(); list($resource, $event) = explode('.', $topic); if(!empty($event)) { $valid_events[] = $event; } return $valid_events; } catch (Exception $e) { return $valid_events; } }, 10); } //Example use: add_action('init', function(){ set_resource_for_webhook_payload_by_webhook_id(3, 'order'); }); /** * Use SKU as gtin8 in structured data */ add_filter( 'woocommerce_structured_data_product','add_gtin8',10,2); function add_gtin8( $markup, $product ) { $markup['gtin8'] = str_replace('-', '',$markup['sku']); return $markup; }; add_filter( 'woocommerce_order_item_permalink', '__return_true' ); add_filter( 'woocommerce_shipping_package_name', 'custom_shipping_package_name' ); function custom_shipping_package_name( $name ) { return 'Study Materials Shipping'; } // Add telephone to shipping add_filter( 'woocommerce_checkout_fields', 'rw_shipping_phone_checkout' ); function rw_shipping_phone_checkout( $fields ) { $fields['shipping']['shipping_phone'] = array( 'label' => 'Local Contact Number', 'type' => 'tel', 'required' => true, 'class' => array( 'form-row-wide' ), 'validate' => array( 'phone' ), 'autocomplete' => 'tel', 'priority' => 25, ); return $fields; } /** * @snippet Search By SKU @ Orders Dashboard - WooCommerce * @how-to Get CustomizeWoo.com FREE * @author Rodolfo Melogli * @compatible WooCommerce 6 * @donate $9 https://businessbloomer.com/bloomer-armada/ */ add_filter( 'woocommerce_shop_order_search_results', 'bbloomer_order_search_by_sku', 9999, 3 ); function bbloomer_order_search_by_sku( $order_ids, $term, $search_fields ) { global $wpdb; if ( ! empty( $search_fields ) ) { $product_id = wc_get_product_id_by_sku( $wpdb->esc_like( wc_clean( $term ) ) ); if ( ! $product_id ) return $order_ids; $order_ids = array_unique( $wpdb->get_col( $wpdb->prepare( "SELECT order_id FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_id IN ( SELECT order_item_id FROM {$wpdb->prefix}woocommerce_order_itemmeta WHERE meta_key IN ( '_product_id', '_variation_id' ) AND meta_value = %d ) AND order_item_type = 'line_item'", $product_id ) ) ); } return $order_ids; } /** Translate "Ship to a Different Address?" @ Checkout */ add_filter( 'gettext', 'rw_translate_shippingtodiffaddr', 9999, 3 ); function rw_translate_shippingtodiffaddr( $translated, $untranslated, $domain ) { if ( ! is_admin() && 'woocommerce' === $domain ) { switch ( $untranslated ) { case 'Ship to a different address?': $translated = 'Deliver my Study Material to?'; break; } } return $translated; } add_filter( 'woocommerce_checkout_coupon_message', 'bbloomer_have_coupon_message'); function bbloomer_have_coupon_message() { return '<i class="fa fa-ticket" aria-hidden="true"></i> <a href="#" class="showcoupon">Have a gift card? If not, please ignore</a>'; } add_action( 'woocommerce_before_checkout_form', 'hide_checkout_coupon_form', 5 ); function hide_checkout_coupon_form() { echo '<style>.woocommerce-form-coupon-toggle {display:none !important;}</style>'; } add_shortcode( 'coupon_field', 'display_coupon_field' ); function display_coupon_field() { if( isset($_GET['coupon']) && isset($_GET['redeem-coupon']) ){ if( $coupon = esc_attr($_GET['coupon']) ) { $applied = WC()->cart->apply_coupon($coupon); } else { $coupon = false; } $success = sprintf( __('Coupon "%s" Applied successfully.'), $coupon ); $error = __("This Coupon can't be applied"); $message = isset($applied) && $applied ? $success : $error; } $output = '<div class="redeem-coupon "><form id="coupon-redeem">If you have a Flashcard coupon enter it here? (Ignore if you do not)<br> <div id="coupon-card-container"> <input type="text" id="coupon" name="coupon" autocomplete="off" placeholder="Coupon Code"> <input id="redeem-coupon" type="submit" name="redeem-coupon" value="'.__('APPLY').'" /> </div> '; $output .= isset($coupon) ? '<p class="result">'.$message.'</p>' : ''; return $output . '</form></div><br>'; } add_action( 'woocommerce_review_order_before_submit', 'bbloomer_add_checkout_privacy_policy', 9 ); function bbloomer_add_checkout_privacy_policy() { woocommerce_form_field( 'privacy_policy', array( 'type' => 'checkbox', 'class' => array('form-row privacy'), 'label_class' => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'), 'input_class' => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'), 'required' => true, 'label' => 'I declare that I am not taking the examination in the UAE or Mainland China as there may be exam software compatibility issues in these countries. Contact us for further details.', )); } // Show notice if customer does not tick add_action( 'woocommerce_checkout_process', 'bbloomer_not_approved_privacy' ); function bbloomer_not_approved_privacy() { if ( ! (int) isset( $_POST['privacy_policy'] ) ) { wc_add_notice( __( 'Please acknowledge that you are not coming residing in UAE or Mainland China' ), 'error' ); } } add_action( 'wp_enqueue_scripts', 'oceanwp_child_enqueue_parent_style' ); // Part 1 // Edit Single Product Page Add to Cart Button add_filter( 'woocommerce_product_single_add_to_cart_text', 'custom_add_to_cart_single_product' ); function custom_add_to_cart_single_product() { global $product; if ( has_term( array('wset-wine-courses', 'wset-wine-courses-online'), 'product_cat', $product->ID ) ) { return 'Book Now'; } else { return 'Add to Cart'; } } // Part 2 // Edit Archive Pages Add to Cart Buttons add_filter( 'woocommerce_product_add_to_cart_text', 'archive_custom_cart_button_text' ); function archive_custom_cart_button_text() { global $product; if ( has_term( array('wset-wine-courses', 'wset-wine-courses-online'), 'product_cat', $product->ID ) ) { return 'Book Now'; } else { return 'Add to Cart'; } } add_filter( 'woocommerce_product_tabs', 'remove_product_tabs', 9999 ); function remove_product_tabs( $tabs ) { unset( $tabs['additional_information'] ); return $tabs; } //hide nag in wp-admin for Smart Manager add_action('admin_head', 'my_custom_fonts'); function my_custom_fonts() { echo '<style> .sm_design_notice {display:none !important; } #dup_sm_editor_grid, #add_sm_editor_grid {display:none !important; } </style>'; } /** * Display field value on the order edit page */ function md_custom_woocommerce_checkout_fields( $fields ) { $fields['order']['order_comments']['placeholder'] = 'Order Notes / Reason for Payment'; $fields['order']['order_comments']['label'] = 'Order Notes / Reason for Payment'; return $fields; } add_filter( 'woocommerce_checkout_fields', 'md_custom_woocommerce_checkout_fields' ); /* ******************* Add dob on WooCommerce checkout page. */ add_action( 'woocommerce_after_checkout_billing_form', 'display_extra_fields_after_billing_address' , 10, 1 ); function display_extra_fields_after_billing_address () { _e( "Date of Birth <span style='color:red;'>*</span>", "add_extra_fields"); ?> <br> <input type="date" name="add_dob" class="add_dob"> <script> jQuery(document).ready(function($) { $(".add_dob").datepicker({ minDate: 0, }); }); </script> <br> <?php _e( "Where did you hear about us? <span style='color:red;'>*</span>", "add_extra_fields"); ?> <br> <select name="heardaboutus" id="heardaboutus"> <option value="">- Select - </option> <option value="The Wine-ish Team">The Wine-ish Team</option> <option value="Google Search">Google Search</option> <option value="Social Media">Social Media</option> <option value="Personal Recommendation">Personal Recommendation</option> <option value="Woolies">Woolworths</option> </select> <?php } add_filter( 'woocommerce_email_order_meta_fields', 'custom_woocommerce_email_order_meta_fields', 10, 3 ); function custom_woocommerce_email_order_meta_fields( $fields, $sent_to_admin, $order ) { $fields['hear_about_us'] = array( 'label' => __( 'Hear About Us' ), 'value' => get_post_meta( $order->id, '_heardaboutus', true ), ); return $fields; } add_action( 'woocommerce_checkout_update_order_meta', 'add_order_dob_to_order' , 10, 1); function add_order_dob_to_order ( $order_id ) { if ( isset( $_POST ['add_dob'] ) && '' != $_POST ['add_dob'] ) { add_post_meta( $order_id, '_dob', sanitize_text_field( $_POST ['add_dob'] ) ); } if ( isset( $_POST ['heardaboutus'] ) && '' != $_POST ['heardaboutus'] ) { add_post_meta( $order_id, '_heardaboutus', sanitize_text_field( $_POST ['heardaboutus'] ) ); } } add_action('woocommerce_checkout_process', 'customised_checkout_field_process'); function customised_checkout_field_process() { // Show an error message if the field is not set. if (!$_POST['add_dob']) wc_add_notice(__('<strong>Date of Birth</strong> is a required field.') , 'error'); if (!$_POST['heardaboutus']) wc_add_notice(__('<strong>Where you heard about us from</strong> is a required field.') , 'error'); } add_filter( 'woocommerce_order_item_permalink', '__return_false' ); add_filter('wc_pay_per_post_my_account_show_purchased', '__return_false'); add_filter('wc_pay_per_post_my_account_show_has_access', '__return_true'); add_filter('wc_pay_per_post_args', 'my_theme_wc_ppp_args'); function my_theme_wc_ppp_args($args){ $args['orderby'] = 'menu_order'; $args['order'] = 'asc' ; return $args; } add_filter( 'woocommerce_thankyou_order_received_text', 'av_thank_you' ); function av_thank_you() { $added_text = '<p>Thank you. Your order has been received and is now being processed. Your order details are shown below for your reference</p>'; return $added_text ; } add_filter( 'woocommerce_get_order_item_totals', 'remove_subtotal_from_orders_total_lines', 100, 1 ); function remove_subtotal_from_orders_total_lines( $totals ) { unset($totals['cart_subtotal'] ); return $totals; } /** * Set the proper resource payload for a custom action webhook * * @param int $target_webhook_id * @param string $desired_resource 'order', 'product', 'coupon', or 'customer' */ function set_resource_for_webhook_payload_by_webhook_id($target_webhook_id, $desired_resource) { //set the desired_resource payload for this webhook ('order', 'product', 'coupon', 'customer') add_filter('woocommerce_webhook_resource', function($resource, $webhook_id) use ($target_webhook_id, $desired_resource) { if($webhook_id == $target_webhook_id) { return $desired_resource; } return $resource; }, 10, 2); //need to ensure our event (i.e., action) is seen as valid, as we've changed the default 'action.' prefix for the topic above add_filter('woocommerce_valid_webhook_events', function($valid_events) use ($target_webhook_id) { try { $topic = wc_get_webhook($target_webhook_id)->get_topic(); list($resource, $event) = explode('.', $topic); if(!empty($event)) { $valid_events[] = $event; } return $valid_events; } catch (Exception $e) { return $valid_events; } }, 10); } //Example use: add_action('init', function(){ set_resource_for_webhook_payload_by_webhook_id(3, 'order'); }); /** * Use SKU as gtin8 in structured data */ add_filter( 'woocommerce_structured_data_product','add_gtin8',10,2); function add_gtin8( $markup, $product ) { $markup['gtin8'] = str_replace('-', '',$markup['sku']); return $markup; }; add_filter( 'woocommerce_order_item_permalink', '__return_true' ); add_filter( 'woocommerce_shipping_package_name', 'custom_shipping_package_name' ); function custom_shipping_package_name( $name ) { return 'Study Materials Shipping'; } // Add telephone to shipping add_filter( 'woocommerce_checkout_fields', 'rw_shipping_phone_checkout' ); function rw_shipping_phone_checkout( $fields ) { $fields['shipping']['shipping_phone'] = array( 'label' => 'Local Contact Number', 'type' => 'tel', 'required' => true, 'class' => array( 'form-row-wide' ), 'validate' => array( 'phone' ), 'autocomplete' => 'tel', 'priority' => 25, ); return $fields; } /** * @snippet Search By SKU @ Orders Dashboard - WooCommerce * @how-to Get CustomizeWoo.com FREE * @author Rodolfo Melogli * @compatible WooCommerce 6 * @donate $9 https://businessbloomer.com/bloomer-armada/ */ add_filter( 'woocommerce_shop_order_search_results', 'bbloomer_order_search_by_sku', 9999, 3 ); function bbloomer_order_search_by_sku( $order_ids, $term, $search_fields ) { global $wpdb; if ( ! empty( $search_fields ) ) { $product_id = wc_get_product_id_by_sku( $wpdb->esc_like( wc_clean( $term ) ) ); if ( ! $product_id ) return $order_ids; $order_ids = array_unique( $wpdb->get_col( $wpdb->prepare( "SELECT order_id FROM {$wpdb->prefix}woocommerce_order_items WHERE order_item_id IN ( SELECT order_item_id FROM {$wpdb->prefix}woocommerce_order_itemmeta WHERE meta_key IN ( '_product_id', '_variation_id' ) AND meta_value = %d ) AND order_item_type = 'line_item'", $product_id ) ) ); } return $order_ids; } /** Translate "Ship to a Different Address?" @ Checkout */ add_filter( 'gettext', 'rw_translate_shippingtodiffaddr', 9999, 3 ); function rw_translate_shippingtodiffaddr( $translated, $untranslated, $domain ) { if ( ! is_admin() && 'woocommerce' === $domain ) { switch ( $untranslated ) { case 'Ship to a different address?': $translated = 'Deliver my Study Material to?'; break; } } return $translated; } add_filter( 'woocommerce_checkout_coupon_message', 'bbloomer_have_coupon_message'); function bbloomer_have_coupon_message() { return '<i class="fa fa-ticket" aria-hidden="true"></i> <a href="#" class="showcoupon">Have a gift card? If not, please ignore</a>'; } add_action( 'woocommerce_before_checkout_form', 'hide_checkout_coupon_form', 5 ); function hide_checkout_coupon_form() { echo '<style>.woocommerce-form-coupon-toggle {display:none !important;}</style>'; } add_shortcode( 'coupon_field', 'display_coupon_field' ); function display_coupon_field() { if( isset($_GET['coupon']) && isset($_GET['redeem-coupon']) ){ if( $coupon = esc_attr($_GET['coupon']) ) { $applied = WC()->cart->apply_coupon($coupon); } else { $coupon = false; } $success = sprintf( __('Coupon "%s" Applied successfully.'), $coupon ); $error = __("This Coupon can't be applied"); $message = isset($applied) && $applied ? $success : $error; } $output = '<div class="redeem-coupon "><form id="coupon-redeem">If you have a Flashcard coupon enter it here? (Ignore if you do not)<br> <div id="coupon-card-container"> <input type="text" id="coupon" name="coupon" autocomplete="off" placeholder="Coupon Code"> <input id="redeem-coupon" type="submit" name="redeem-coupon" value="'.__('APPLY').'" /> </div> '; $output .= isset($coupon) ? '<p class="result">'.$message.'</p>' : ''; return $output . '</form></div><br>'; } add_action( 'woocommerce_review_order_before_submit', 'bbloomer_add_checkout_privacy_policy', 9 ); function bbloomer_add_checkout_privacy_policy() { woocommerce_form_field( 'privacy_policy', array( 'type' => 'checkbox', 'class' => array('form-row privacy'), 'label_class' => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'), 'input_class' => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'), 'required' => true, 'label' => 'I declare that I am not taking the examination in the UAE or Mainland China as there may be exam software compatibility issues in these countries. Contact us for further details.', )); } // Show notice if customer does not tick add_action( 'woocommerce_checkout_process', 'bbloomer_not_approved_privacy' ); function bbloomer_not_approved_privacy() { if ( ! (int) isset( $_POST['privacy_policy'] ) ) { wc_add_notice( __( 'Please acknowledge that you are not coming residing in UAE or Mainland China' ), 'error' ); } }
Those are a lot of plugins! :).
Hard to say but one of them might (or your theme) be conflicting and therefore is throwing an error.Have you performed a test (disabling other plugins) to see if there is a plugin conflict?
Closing due to inactivity but feel free to reopen if issues persist.
- The topic ‘Field Groups not showing’ is closed to new replies.