ResolvedBranch/Store visualization and change

Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #37145
    swellboyvn
    Participant

    How to place a button in the header/ menu with the selected branch. On click to show the popup again for branch changing?

    #37149
    swellboyvn
    Participant

    How to temporarily close one of the stores/branches if need it?

    #37152
    swellboyvn
    Participant

    I found it. How to set different order numbers for different locations/branches in the header?

    #37175
    Alex
    Keymaster

    Hello swellboyvn,

    Sorry for the delay.

    You can use one, all, or some of the predefined places where to put the currently selected branch info box (with a button to change the branch). Go to WooCommerce-> Lafka Shipping Settings -> Branch Locations -> Show Branches Info Box in

    It is possible also to add it to more specific places but it will require some custom coding. You can look at the following topic for more details: Need pickup and delivery selector in header

    I am not sure I understand your other question about the order numbers. Could you please be more specific.

    Regards,
    Alex

    #37192
    swellboyvn
    Participant

    In your functions.php of the child theme add this code:

    function branches_shortcode() {
        ob_start(); // start output buffering
        
        // call the Lafka_Branch_Locations::show_change_branch() function
        add_action('get_footer', array('Lafka_Branch_Locations', 'show_change_branch'), 1);
        Lafka_Branch_Locations::show_change_branch();
        
        $output = ob_get_clean(); // get the buffered output
        return $output;
    }
    add_shortcode('branches', 'branches_shortcode');

    After that, you can display the branches picker anywhere with this block [branches].

    Thank you Alex.

    #37194
    swellboyvn
    Participant

    Small fix 🙂

    function branches_shortcode($atts) {
        $atts = shortcode_atts(array(
            'id' => '',
        ), $atts, 'branches');
        
        static $content = array(); // declare a static variable to store the content
        
        if (!isset($content[$atts['id']])) {
            ob_start(); // start output buffering
            
            Lafka_Branch_Locations::show_change_branch();
            
            $content[$atts['id']] = ob_get_clean(); // get the buffered output
        }
        
        return $content[$atts['id']];
    }
    add_shortcode('branches', 'branches_shortcode');
    
Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register