Jedinica mjere | WordPress.org

[ad_1]

Pozdrav!

Postoji filter woo_solo_api_modify_request_body koji prima 2 argumenta: $requestBody i $order.

Svaki put kad se napravi request, tu se mogu onda mijenjati jedinicne mjere tako da se izmjeni

$requestBody["jed_mjera_{$itemNo}"] = CUSTOM_MJERA; za svaki item (ovaj $itemNo oznacava svaki element u narudzbi).

Neki proto kod bi izgledao ovako:


add_filter('woo_solo_api_modify_request_body', 'custom_prefix_modify_request');

function custom_prefix_modify_request($requestBody, $order) {

    if(!function_exists('get_field')) {
        // No ACF!
        return $requestBody;
    }

    $acfMeasure = get_field('custom_measure_for_order') ?? 1;

    // Filter by order (ID, or some other identifier).

    // Need to see which jedinicna mjera needs to be changed.
    $requestBody['jed_mjera_1'] = $acfMeasure;

    return $requestBody;
}

Thread Starter
sonnic

(@ikozlik)

Muchas gracias Señor.
To bude radilo, prilagodim, ali sad mi je jasnije.

Drago mi je da sam uspio pomoci 🙂

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer