• Resolved netmorais

    (@netmorais)


    How to programmatically get product properties like default quantity or minimum quantity with javascript, theoretical example: my_quantity_default = product.quantity_default;

    • This topic was modified 1 year, 7 months ago by netmorais.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author wpgear

    (@wpgear)

    Hello netmorais!

    In the current version of the plugin, unfortunately there is no such possibility.
    Well, because there was no such need

    Thread Starter netmorais

    (@netmorais)

    Dear. I’m “testing” the following Javascript function and I’m getting good results. Suppose the Object of a certain product named “product” already exists:

    function get_woo_dec_pro_ite_qnt () {
    var woo_dec_pro_ite_qnt = “”; for (var i in product.meta_data) {
    if (product.meta_data[i][‘key’] == ‘woodecimalproduct_item_qnt’)
    { woo_dec_pro_ite_qnt = product.meta_data[i][‘value’]; }}
    return woo_dec_pro_ite_qnt; }

    if (get_woo_dec_pro_ite_qnt () == “”) { console.log (“not found”); }
    else{ console.log (get_woo_dec_pro_ite_qnt ()); }

    Grateful. Sergio.

    Plugin Author wpgear

    (@wpgear)

    Cool ))

    Thread Starter netmorais

    (@netmorais)

    Guys, I’m going to repeat my suggestion on how to programmatically get product properties, such as default quantity:

    I’m “testing” the following Javascript function and I’m getting good results. Suppose the Object of a certain product named “product” already exists:

    function get_woo_dec_pro_ite_qnt() {
    var woo_dec_pro_ite_qnt = “”; for (var i in product.meta_data) {
    if (product.meta_data[i][‘key’] == ‘wooddecimalproduct_item_qnt’)
    { woo_dec_pro_ite_qnt = product.meta_data[i][‘value’]; }}
    return woo_dec_pro_ite_qnt; }

    if (get_woo_dec_pro_ite_qnt() == “”) { console.log (“not found”); }
    else{ console.log(get_woo_dec_pro_ite_qnt()); }

    The suggested function uses: wooddecimalproduct_item_qnt which is a plugin metadata: “Decimal Product Quantity for WooCommerce”

    Grateful. Sergio.

    Plugin Author wpgear

    (@wpgear)

    Hi Bro!

    I tell you exactly that in my Plugin there is no JS Oject like: Product

    But if you say why you need it, and what exactly you want to do, then I can think about it.

    Thread Starter netmorais

    (@netmorais)

    Hello. I’m configuring a POS plugin, specifically “WePos for Woocommerce” and trying to integrate it with “Decimal Product Quantity for WooCommerce”, “DpQt”. To do that I need to have access to the “Meta Data” of “DpQt” to transfer them to “WePos”. I asked this forum how to do this programmatically and they replied that in this version there was no possibility. Despite this, I continued researching and found a solution, not at all elegant, but it was working, so I decided to just make a “Suggestion” to the forum. Grateful. Sergio.

    Plugin Author wpgear

    (@wpgear)

    Not so simple.
    The parameters of the Quantity (Min/Max/STEP/Default) for each Product is a Hierarchical Structure.

    Product -> Product Category -> Global Settings.

    In fact, it is even more difficult:
    Product Variation -> Product -> Product Category -> Global Settings.

    The value for each of the parameters is determined by this chain until it is determined.

    That is why I say that in this version of the Plugin there is no ready to use the parameters of Quantity for external use as Object (JS).

    But now, when you explained why this is necessary, I will try to add such an opportunity in the next version.

    Thread Starter netmorais

    (@netmorais)


    OK thanks. I await the new version. Sergio.

    Plugin Author wpgear

    (@wpgear)

    try v10.30

    Product JS Object: QNT_Data

    Use Function: DPQW_Get_QuantityData (Product_ID)

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to get programmatically product properties like default quantity’ is closed to new replies.