Skip to content

Instantly share code, notes, and snippets.

@AashikP
AashikP / wcs_custom_frequency.php
Last active August 10, 2022 08:54
WooCommerce Subscriptions – Custom Renewal Frequency
<?php
/**
* This function adds custom renewal intervals for WooCommerce Subscription Products.
* The code as it is adds `every 8th` and `every 10th` custom frequency for Subscription renewals.
* To include more frequencies, add a comma separated value within the bracket.
* Eg, if you need an `every 9th` frequency here's how you'd update line#10 : $custom_frequency = array( 8, 9, 10 );
*/
function wcs_custom_frequency( $intervals ) {
$custom_frequency = array( 8, 10 );
@AashikP
AashikP / wcs-enable-staging-mode.php
Created November 10, 2021 03:24
This will set Subscriptions to Manual renewal and disable Subscription emails.
<?php
/**
* Plugin Name: WCS Enable Staging mode
* Description: This will set Subscriptions to Manual renewal and disable Subscription emails.
* Version: 1.0
* Author: AashikP
* Author URI: https://aashikp.com
* Text Domain: wcs-enable-staging-mode
* Requires at least: 5.0
* Requires PHP: 7.4
@AashikP
AashikP / wp_wc_admin_note.sql
Created July 3, 2021 05:29
Create Note and Note Actions table for WooCommerce admin
CREATE TABLE `wp_wc_admin_notes` (
`note_id` bigint(20) UNSIGNED NOT NULL,
`name` varchar(255) NOT NULL,
`type` varchar(20) NOT NULL,
`locale` varchar(20) NOT NULL,
`title` longtext NOT NULL,
`content` longtext NOT NULL,
`icon` varchar(200) NOT NULL DEFAULT 'info',
`content_data` longtext DEFAULT NULL,
`status` varchar(200) NOT NULL,
@AashikP
AashikP / dev.php
Last active April 28, 2021 13:14
var_dump as dashboard notice.
<?php
/**
* Function to var_dump contents as WordPress Dashboard notification.
*
* Instructions:
* Optional argument $file can be supplied as __FILE__ $line supplied as __LINE__ if you also want to
* print out the file and line number (for whatever reason) where this function is called.
*
* @param variable $dump_this Will dump the variable as an admin notice.
@AashikP
AashikP / square-list-locations.php
Last active July 13, 2021 04:08
Simple script that connects to Square Locations API via cURL and returns existing locations on your account
<?php
/**
* Simple script that connects to Square Locations API via cURL and returns existing locations on your account.
* This is helpful when Square extension does not retrive the locations, and webhosts claim that cURL is working as expected
* Source: https://developer.squareup.com/docs/locations-api
*
* USAGE:
* This is not a WordPress plugin, so please upload this script to the root directory of the site
* and access it directly: https://example.com/square-list-locations.php
*
@AashikP
AashikP / test-gist.php
Created November 22, 2020 07:26
Test Gist
<?php
echo 'This is a test gist';