Forum Replies Created

Viewing 15 replies - 16 through 30 (of 61 total)
  • Hi David,

    Have you tried switching themes? Have you also tried deactivating current plugins on-by-one to see if a change of one plugin changes the display.
    Have you you checked console for errors?

    Lets try the below code:

    function hide_menu_conditional($items, $args) {
        // Check if the menu location is your primary menu
        if ($args->theme_location == 'primary-menu') {
            // Check if the USer is logged in
            if (is_user_logged_in()) {
                // If the user is logged in , find the menu item with the title 'Store Manager'
                foreach ($items as $key => $item) {
                    if ($item->title == 'Store Manager') {
                        // Remove the menu item
                        unset($items[$key]);
                        break;
                    }
                }
            }
        }
    
        return $items;
    }
    
    add_filter('wp_nav_menu_objects', 'hide_menu_conditional', 10, 2);
    

    Great! You’re welcome!

    Hello,

    if you add the code within code snippets, you don’t need to use a child theme.

    • This reply was modified 2 years, 9 months ago by Phill.

    You can put it at the bottom of the file, after the other code. Alternatively you can download a plugin like Code Snippets and drop the code in there (and activate).

    If you’re putting in functions.php, it’s best in a child theme as otherwise when you update your theme later you will lose your code.

    Hello, are you using any cache plugin or does your host use a caching system?

    This is often a reason why changes are pushed at a slightly later time than when you make the actual update.

    Hello,

    The link to your staging site didn’t work as it was a draft page. Could you recheck and update? I think this will give us a better understanding of what you are trying to achieve 🙂

    Hello,

    I think the WooCommerce dedicated support forum would be well suited for this one:

    https://wordpress.org/support/plugin/woocommerce/

    You should remove the final part. So your code would be as below.

    I tested on a fresh Blocksy theme and it works as described (not displaying in the front end). Like all code changes, make sure you backup before hand incase of any conflicts.

    /**
     * Function to render UI in Admin Product add/edit page
     */
    function show_custom_price_admin() {
    
        global $thepostid;
    
        woocommerce_wp_text_input(
            array(
                'id'    => 'custom_price',
                'name'  => '_custom_price',
                'value' => get_post_meta( $thepostid, '_custom_price', true ),
                'class' => 'wc_input_price short',
                'label' => __( 'Custom Price ($)', 'vg' ),
            )
        );
    }
    add_action( 'woocommerce_product_options_pricing', 'show_custom_price_admin' );
    
    /**
     * Function to update custom price Admin Product add/edit page
     *
     * @param int $post_id Product's post id.
     */
    function process_product_custom_data( $post_id ) {
    
        $product = wc_get_product( $post_id );
    
        $product->update_meta_data(
            '_custom_price',
            wc_clean( wp_unslash( filter_input( INPUT_POST, '_custom_price' ) ) )
        );
        $product->save();
    }
    add_action( 'woocommerce_process_product_meta', 'process_product_custom_data' );
    

    Let me know if it works!

    • This reply was modified 2 years, 9 months ago by Phill.

    Hello, please see my answers

    1. You could use a sub domain- for example staging.examplesite.com
    2. Could you give them the front end url once you’re completed ready for approval?

    Good luck with the site!

    Not sure if you need to hook within the single product page, you can remove that part of the code if needs be.

    code goes in functions.php of your child theme or a code snippets plugin.

    /**
     * Function to render UI in Admin Product add/edit page
     */
    function show_custom_price_admin() {
    
        global $thepostid;
    
        woocommerce_wp_text_input(
            array(
                'id'    => 'custom_price',
                'name'  => '_custom_price',
                'value' => get_post_meta( $thepostid, '_custom_price', true ),
                'class' => 'wc_input_price short',
                'label' => __( 'Custom Price ($)', 'vg' ),
            )
        );
    }
    add_action( 'woocommerce_product_options_pricing', 'show_custom_price_admin' );
    
    /**
     * Function to update custom price Admin Product add/edit page
     *
     * @param int $post_id Product's post id.
     */
    function process_product_custom_data( $post_id ) {
    
        $product = wc_get_product( $post_id );
    
        $product->update_meta_data(
            '_custom_price',
            wc_clean( wp_unslash( filter_input( INPUT_POST, '_custom_price' ) ) )
        );
        $product->save();
    }
    add_action( 'woocommerce_process_product_meta', 'process_product_custom_data' );
    
    /**
     * Function to show custom price front end page
     */
    function show_custom_price_frontend() {
        global $post;
    
        $custom_price = get_post_meta( $post->ID, '_custom_price', true );
    
        if ( $custom_price ) {
            $custom_price = wc_price( $custom_price );
    
            printf( '<p class="price">%s</p>', $custom_price );
        }
    }
    add_action( 'woocommerce_before_add_to_cart_form', 'show_custom_price_frontend' );

    Something is wrong with the data serialization so we get the raw content instead of intended article. It’s tricky to troubleshoot just based on this, but I hope this helps and don’t forget to check your error logs:

    1. Check plugin theme conflict, console errors.
    2. Are you using a third party api to get any content? Could be an issue here
    3. php memory limit- insufficient memory can cause this intermittently
    4. data corruption at server or database level can cause what is occurring here.
    5. run a malware scan also incase a vulnerable plugin is causing data corruption.
    • This reply was modified 2 years, 9 months ago by Phill.

    Is the data available on a REST API/ JSON Feed ? If so then you can pull and display as required with a bit of programming.

    Alternatively you can use bulk import to posts tool such as WP all import.

    The page displays as normal for me. I can’t see any JSON error in the front end.

    Hi @vitb


    Have you tried:

    https://yourdomain.com/?add-to-cart=88&variation_id=73&attribute_pa_interval=yearly
Viewing 15 replies - 16 through 30 (of 61 total)