Custom Fields
Re-Envisioned
Support MB Blocks Callbacks in block doesn't refresh

  • Creator
    Topic
  • #28005
    Resolved AXEL PARATRE
    Participant

    Hello team,

    We have an issue with the call back functions within a block in a select (MB Block).

    the call back gather for exemple all WooCommerce product, don't refresh the product list when a new one in created.

    Do you the way to automatically refresh the result of the callback function.

    Regards,
    Adrien

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #28017
    Long Nguyen
    Moderator

    Hi,

    Can you please share some screenshots and the code that creates the block, callback function? I've re-checked on my local site and see the callback result updates as well.

    #28065
    AXEL PARATRE
    Participant

    Hi,
    The callback is included in the block builder (cf screenshot).
    If add a other product (in the good term) i dont see it in the selector

    1620632247-capture-12.png - envoi d'image avec NoelShack

    function nxt_get_accessories_list() {
        $posts = get_posts([
            "post_type"   => "product",
            "tax_query"   => [
                [
                    "taxonomy"    => "product_cat",
                    "field"       => "slug",
                    "terms"       => "accessoires"
                ]
            ]
        ]);
        $posts = array_map(
            function($post) {
                return [
                    $post->ID,
                    $post->post_title
                ];
            },
            $posts
        );
        return array_column(
            $posts,
            1,
            0
        );
    }
    #28075
    Long Nguyen
    Moderator

    Hi,

    Click on the Edit and Preview button of the block, it reloads and fetches the new data as well. Screen record https://share.getcloudapp.com/X6ue60En. Can you please deactivate all plugins except Meta Box and MB extensions to re-check the issue?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.