Automatic discount for shipping

Hello,

Our store currently has a program called Free Ship Friday, which makes all shipping methods below $30 free on Fridays.

Unfortunately, as of right now, there is no way for us to make this automatic, we have to manually create the automatic discount every single Friday.

We have tried using Scripts, it does not allow access to call for Time, and we have not found any apps thus far that work.

Does anyone have a recommendation on how exactly this can be automated?

Chris

Hi @Cwilliams44

To streamline your Free Ship Friday process, you could utilize the Shopify API to develop a tailored script that will autonomously generate the discount on Fridays and eliminate it after a 24-hour period.

Here’s an example in Python that demonstrates how to utilize the Shopify API to automatically set up a Free Ship Friday discount:

import os
import datetime
import shopify
from dotenv import load_dotenv

load_dotenv()

API_KEY = os.getenv('SHOPIFY_API_KEY')
API_PASSWORD = os.getenv('SHOPIFY_API_PASSWORD')
SHOP_NAME = os.getenv('SHOPIFY_SHOP_NAME')

shopify.ShopifyResource.set_user(API_KEY)
shopify.ShopifyResource.set_password(API_PASSWORD)
shopify.ShopifyResource.set_site(f"https://{SHOP_NAME}.myshopify.com/admin")

def create_freeship_friday_discount():
    today = datetime.date.today()
    if today.weekday() == 4: # Check if today is Friday (weekday() returns 4 for Friday)
        # Create price rule
        price_rule = shopify.PriceRule.create({
            'title': 'Free Ship Friday',
            'target_type': 'shipping_line',
            'value': '-100',
            'value_type': 'percentage',
            'allocation_method': 'each',
            'starts_at': today.isoformat(),
            'ends_at': (today + datetime.timedelta(days=1)).isoformat()
        })

        # Create discount code using the price rule ID
        discount_code = shopify.DiscountCode.create({
            'price_rule_id': price_rule.id,
            'code': 'FREESHIPFRIDAY'
        })

if __name__ == "__main__":
    create_freeship_friday_discount()

I hope this helps.

Hi, Chris!

I understand how helpful it would be to schedule your recurring discount, and I’m happy to submit a feature request to our developers on your behalf.

In the meantime, I have a couple of app suggestions that offer a scheduling feature for discounts:

You could easily do this with ShipperHQ plugin rules.