• Resolved kon30fyllou

    (@kon30fyllou)


    I am trying to use your plugin for a product feed for skroutz.gr. I would like to add instock attribute to the feed. Could you explaine to me if this can be done with your plugin? Following you can find the documentation for this attribute from skroutz.gr

    InStock
    Stock status of the product

    Y
    means that the product is in stock at your outlet or your warehouse and can be picked up immediately.
    N
    means that the product is not available in stock.

Viewing 14 replies - 1 through 14 (of 14 total)
  • supportadtribes

    (@supportadtribes)

    Hi,

    Thanks for using our plugin and reaching out to us.

    The best way would be to use the availability attribute for this.

    First you create a new attribute in WooCommerce like this:
    https://www.dropbox.com/s/n7sb8beqwii83is/Skroutz-stock-1.png?dl=0

    Then you add a field mapping (hot the orange + Add field mapping button) and add the instock field to the mapping and map it to the new attribute you just created. Like this: https://www.dropbox.com/s/kwpuyh11rluihyy/Skroutz-stock-2.png?dl=0

    Now you create the following rules:
    https://www.dropbox.com/s/y26g31cnvhfh42s/Skroutz-stock-3.png?dl=0

    After you did so you manually refresh the product feed. You’ll now find things like this in your feed: https://www.dropbox.com/s/9s6mc6u9bkedtnn/Skroutz-stock-4.png?dl=0

    Hope this helps?

    Thread Starter kon30fyllou

    (@kon30fyllou)

    Thank you for your answer. Could you please tell me which function availability option uses? I have set one more stock status (i.e. pre_order) option and I would like to use this too.

    supportadtribes

    (@supportadtribes)

    Availability outputs these values:

    • out of stock
    • in stock
    • on backorder

    Those are the default WooCommerce stock status.

    Thread Starter kon30fyllou

    (@kon30fyllou)

    Which woocommerce function do you use to take these values? I use woocommerce_product_stock_status_options filter to add extra stock status.

    supportadtribes

    (@supportadtribes)

    
    $stock_status = $product->get_stock_status();
    if ($stock_status == "outofstock"){
          $product_data['availability'] = "out of stock";
    } elseif ($stock_status == "onbackorder") {
          $product_data['availability'] = "on backorder";
    } else {
          $product_data['availability'] = "in stock";
    }
    
    Thread Starter kon30fyllou

    (@kon30fyllou)

    As you can see from skroutz documentation there are 3 different availability options. This is why I would like to have one more stock option. So should I edit your plugin code to include my custom stock option? Is there any other way?

    Availability
    This product’s shipping availability as used throughout your shop.

    Skroutz uses a fixed set of availability descriptions that will be crosslinked to the ones provided in your feed.

    Available in store / Delivery 1 to 3 days
    refers to products that are available for pick up at your outlet.
    Delivery 1 to 3 days
    refers to products that can be delivered to your customer within 1 to 3 days.
    Delivery 4 to 10 days
    refers to products that can be delivered to your customer within 4 to 10 days.
    Delivery up to 30 days
    refers to products that can be delivered to your customer within 30 days.

    supportadtribes

    (@supportadtribes)

    I am going to assume your

    custom stock option

    are saved in an attribute? If so, you can also just map that attribute directly to Skroutz’s InStock field. That will be the easiest and fastest way.

    Thread Starter kon30fyllou

    (@kon30fyllou)

    No it is not saved as an attribute. It is an extra stock option. I use the following code to achieve that.

    function filter_woocommerce_product_stock_status_options( $status ) {
        // Add new statuses
        $status['pre_order'] = __( 'Pre order', 'woocommerce' );
        return $status;
    }

    So on your code there should be an extra if statement to check for my stock status. Right? Otherwise how can I check if stock status of the product is pre_order?

    supportadtribes

    (@supportadtribes)

    Yes that is correct, it should be something like this:

    $stock_status = $product->get_stock_status();
    if ($stock_status == "outofstock"){
          $product_data['availability'] = "out of stock";
    } elseif ($stock_status == "onbackorder") {
          $product_data['availability'] = "on backorder";
    } elseif ($stock_status == "Pre order") {
          $product_data['availability'] = "pre order";
    } else {
          $product_data['availability'] = "in stock";
    }

    And then you can create similar rules as I have shown before.

    Thread Starter kon30fyllou

    (@kon30fyllou)

    Thank you very much. The only problem is that I will loose my changes after a plugin update.

    supportadtribes

    (@supportadtribes)

    Yes that indeed, unfortunately, is true. We however cannot add the code to our plugin as you would be the only one out of 60.000 users who needs it.

    Thread Starter kon30fyllou

    (@kon30fyllou)

    I know, that’s not what I am asking. Maybe as a future update you could have a field that shows directly the output of get_stock_status(); without doing the check hardcoded. In that way I could solve the problem through the plugin without touching the code.

    supportadtribes

    (@supportadtribes)

    we have just pushed out a new release of the plugin (version 9.7.3) for you that has an extra attribute in it: “Stock Status WooCommerce“:
    https://www.dropbox.com/s/3zhx3rszxxpuamu/StockStatusWooCommerce.png?dl=0

    that should solve the issue at hand for you?

    Thread Starter kon30fyllou

    (@kon30fyllou)

    Yes I think so. Thank you very much for your support!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Skroutz.gr instock attribute’ is closed to new replies.