• “Sorry but your code causes a “fatal error”, so it is not applied!
    Please, check the code and try again.

    this is the code that I entered. It is a php code to implement WooCommerce with Zoom webinars. Now I am locked our my my admin page as well.

    “The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.” No email has been received.

    // add hidden field in order after checkout
    add_action( ‘woocommerce_checkout_before_customer_details’, ‘my_custom_checkout_hidden_field’, 10, 1 );
    function my_custom_checkout_hidden_field( $checkout ) {
    foreach ( WC()->cart->get_cart() as $cart_item ) {
    $product = $cart_item[‘data’];
    if(!empty($product)){
    $webinar_id = $product->get_attribute( ‘webinar_id’ );
    // Output the hidden field
    echo ‘<div id=”user_link_hidden_checkout_field”>
    <input type=”hidden” class=”input-hidden” name=”webinar_id” id=”webinar_id” value=”‘ . $webinar_id . ‘”>
    </div>’;
    }
    }
    }
    // save hidden field in the order
    add_action( ‘woocommerce_checkout_update_order_meta’, ‘save_custom_checkout_hidden_field’, 10, 1 );
    function save_custom_checkout_hidden_field( $order_id ) {
    if ( ! empty( $_POST[‘webinar_id’] ) )
    update_post_meta( $order_id, ‘_webinar_id’, sanitize_text_field( $_POST[‘webinar_id’] ) );
    }
    //only 1 prod in cart for WooC
    add_filter( ‘woocommerce_add_to_cart_validation’, ‘bbloomer_only_one_in_cart’, 99, 2 );
    function bbloomer_only_one_in_cart( $passed, $added_product_id ) {
    // empty cart first: new item will replace previous
    wc_empty_cart();
    return $passed;
    }

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter mbenatar

    (@mbenatar)

    correction bag is https://clinicalavianpathologyservices.com

    Can anyone help me?

    Thread Starter mbenatar

    (@mbenatar)

    Thank you. I did this process and was able to get my site back up. But I am not a coder and never was able to figure out the syntax error of this css code.

    // add hidden field in order after checkout
    add_action( ‘woocommerce_checkout_before_customer_details’, ‘my_custom_checkout_hidden_field’, 10, 1 );
    function my_custom_checkout_hidden_field( $checkout ) {
    foreach ( WC()->cart->get_cart() as $cart_item ) {
    $product = $cart_item[‘data’];
    if(!empty($product)){
    $webinar_id = $product->get_attribute( ‘webinar_id’ );
    // Output the hidden field
    echo ‘<div id=”user_link_hidden_checkout_field”>
    <input type=”hidden” class=”input-hidden” name=”webinar_id” id=”webinar_id” value=”‘ . $webinar_id . ‘”>
    </div>’;
    }
    }
    }
    // save hidden field in the order
    add_action( ‘woocommerce_checkout_update_order_meta’, ‘save_custom_checkout_hidden_field’, 10, 1 );
    function save_custom_checkout_hidden_field( $order_id ) {
    if ( ! empty( $_POST[‘webinar_id’] ) )
    update_post_meta( $order_id, ‘_webinar_id’, sanitize_text_field( $_POST[‘webinar_id’] ) );
    }
    //only 1 prod in cart for WooC
    add_filter( ‘woocommerce_add_to_cart_validation’, ‘bbloomer_only_one_in_cart’, 99, 2 );
    function bbloomer_only_one_in_cart( $passed, $added_product_id ) {
    // empty cart first: new item will replace previous
    wc_empty_cart();
    return $passed;
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Fatal Error’ is closed to new replies.