Skip to content

Instantly share code, notes, and snippets.

Avatar

SomewhereWarm SMPC somewherewarm-snippets

View GitHub Profile
View apfs-disable-coupons-for-cart-with-subscription-items.php
<?php
/**
* Plugin Name: All Products for WooCommerce Subscriptions - Disable Coupons When Cart contains products on Subscription
* Plugin URI: https://woocommerce.com/products/all-products-for-woocommerce-subscriptions/
* Description: Use this snippet to prevent coupons from applying in the cart if there is at least one product on Subscription there.
* Version: 1.0
* Author: SomewhereWarm
* Author URI: https://somewherewarm.gr/
* Developer: Jason Kytros
*
View apfs-restore-add-to-cart-buttons-in-shop-archives.php
<?php
/**
* Plugin Name: All Products for WooCommerce Subscriptions - Restore Add to Cart buttons in Shop Archives
* Plugin URI: https://woocommerce.com/products/all-products-for-woocommerce-subscriptions/
* Description: Use this snippet to hide cart item subscription options.
* Version: 1.0
* Author: SomewhereWarm
* Author URI: https://somewherewarm.gr/
* Developer: Jason Kytros
*
View apfs-disable-coupons-for-products-on-subscription.php
<?php
/**
* Plugin Name: All Products for WooCommerce Subscriptions - Disable Coupons for Products on Subscription
* Plugin URI: https://woocommerce.com/products/all-products-for-woocommerce-subscriptions/
* Description: Use this snippet to prevent coupons from applying to cart items on Subscription.
* Version: 1.0
* Author: SomewhereWarm
* Author URI: https://somewherewarm.gr/
* Developer: Jason Kytros
*
View apfs-remove-catalog-price-subscription-suffix.php
<?php
/**
* Plugin Name: All Products for WooCommerce Subscriptions - Remove Catalog Price Subscription Suffix
* Plugin URI: https://woocommerce.com/products/all-products-for-woocommerce-subscriptions/
* Description: Use this snippet to hide cart item subscription options.
* Version: 1.0
* Author: SomewhereWarm
* Author URI: https://somewherewarm.gr/
* Developer: Jason Kytros
*
@somewherewarm-snippets
somewherewarm-snippets / cp-lazy-load-disable.php
Created May 26, 2020
Use this snippet to disable lazy-loading of Component Options data.
View cp-lazy-load-disable.php
<?php
/**
* Plugin Name: WooCommerce Composite Products - Disable Lazy Loading
* Plugin URI: https://woocommerce.com/products/composite-products/
* Description: Use this snippet to disable lazy-loading of Component Options data.
* Version: 1.0
* Author: SomewhereWarm
* Author URI: https://somewherewarm.com/
* Developer: Manos Psychogyiopoulos
*
View pb-rest-api-add-bundle-to-order.txt
curl -X PUT https://example.com/wp-json/wc/v1/orders/199 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-k \
-d '{
"line_items": [
{
"product_id": 30,
"quantity": 1,
"bundle_configuration": [
View pb-rest-api-add-bundled-item.txt
curl -X PUT https://example.com/wp-json/wc/v1/products/133 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"bundled_items": [
{
"product_id": 70,
"quantity_min": 1,
"quantity_max": 1,
View pb-rest-api-delete-bundled-item.txt
curl -X PUT https://example.com/wp-json/wc/v1/products/133 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"bundled_items": [
{
"bundled_item_id": 70,
"product_id" : 35,
"delete": true
}
View pb-rest-api-create-bundle.txt
curl -X POST https://example.com/wp-json/wc/v1/products \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"name": "Happy Ninja Bundle",
"type": "bundle",
"regular_price": "53.0",
"sale_price": "37.0",
"description": "In pretium enim justo, at ornare libero aliquam quis. Nullam imperdiet rutrum volutpat. Suspendisse aliquet ex in ex volutpat vestibulum. Curabitur ultrices convallis condimentum.",
"short_description": "In pretium enim justo, at ornare libero aliquam quis.",
View pb-rest-api-modify-bundled-item.txt
curl -X PUT https://example.com/wp-json/wc/v1/products/133 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"bundled_items": [
{
"bundled_item_id": 70,
"product_id" : 35,
"quantity_max": 10,
"title": "Flying Ninja Posters"
You can’t perform that action at this time.