Skip to content

Instantly share code, notes, and snippets.

View robert1112's full-sized avatar
🎯
Focusing

Robert C robert1112

🎯
Focusing
View GitHub Profile
add_action( 'woocommerce_product_options_general_product_data', __CLASS__ . '::subscription_pricing_fields' );
function remove_prcing(){
remove_action('woocommerce_product_options_general_product_data','WC_Subscriptions_Admin::subscription_pricing_fields' );
}
add_action('init', 'remove_prcing');
@shakeeb-mts
shakeeb-mts / functions.php
Last active October 7, 2018 16:01
Merge Subscriptions
<?php
/**
* Remove woocommerce and woo-subscriptions delete actions.
* @return [type] [description]
*/
function mts_remove_delete_actions() {
remove_action( 'delete_user', 'WC_Subscriptions_Manager::trash_users_subscriptions' );
remove_action( 'deleted_user', 'wc_reset_order_customer_id_on_deleted_user' );
}
<?php
/**
* Add $number param to woocommerce-subscriptions.
*
* @param int (optional) An interval in the range 1-6
* @param string (optional) One of day, week, month or year. If empty, all subscription ranges are returned.
* @since 2.0
*/
function wcs_get_subscription_period_strings( $number = 1, $period = '' ) {
<?php
/**
Plugin Name: GW Modify Subscription Pricing
Plugin URI: http://kovick.com/
Description: A plugin for WooCommerce + Subscription Add-on + Gravity Form Products Add-on which only adds the pricing to the signup fee rather than to the recurring fee.
Version: 1.0
Author: David Smith
Author URI: http://ounceoftalent.com
License: GPL2
@moskalukigor
moskalukigor / variable-subscription.php
Created March 17, 2017 14:22
Custom Variable Subscription (Radio Button)
<?php
/**
* Variable subscription product add to cart
*
* @author Prospress
* @package WooCommerce-Subscriptions/Templates
* @version 2.0.9
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
@pjv
pjv / functions.php
Last active October 9, 2018 18:22
put into functions.php to make WooCommerce cart default to choosing the cheapest shipping option
// https://github.com/woothemes/woocommerce/issues/3641
// http://stackoverflow.com/questions/36300773/woocommerce-programmatically-changing-the-default-shipping-method
// guts of function straight copy of function get_default_method from WC v. 2.5.5 includes/class-wc-shipping.php
function plx_default_cheapest_shipping_method( $current_chosen_method, $available_methods ) {
$selection_priority = get_option( 'woocommerce_shipping_method_selection_priority', array() );
if ( ! empty( $available_methods ) ) {
@swaters2858
swaters2858 / call-for-payment-information.php
Created January 16, 2018 16:55
wc-custom-payment-gateways-by-sam
<?php
// Make sure WooCommerce is active
if ( ! in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) return;
//Adds Child Gateway Class
add_action( 'plugins_loaded', 'init_call_for_payment_info' );
function init_call_for_payment_info() {
class WC_Gateway_Call_for_Payment_Info extends WC_Payment_Gateway {
//Construct Gateway
@WillBrubaker
WillBrubaker / my-subscriptions.php
Last active July 8, 2021 13:24
A template override to add a JavaScript confirmation pop-up to WooCommerce Subscriptions cancel button
<?php
/**
* My Subscriptions
*/
?>
<div class="woocommerce_account_subscriptions">
<h2><?php _e( 'My Subscriptions', 'woocommerce-subscriptions' ); ?></h2>
<?php if ( ! empty( $subscriptions ) ) : ?>
@lukecav
lukecav / wordpress.conf
Last active January 10, 2023 13:44
Docker image with Nginx front-end for WordPress PHP-FPM image - Updated NGNIX config - includes updated expires headers, browser caching and Gzip enabled.
# WordPress single site rules.
# Designed to be included in any server {} block.
# This order might seem weird - this is attempted to match last if rules below fail.
# http://wiki.nginx.org/HttpCoreModule
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
@corsonr
corsonr / functions.php
Created September 28, 2016 08:33
Display WooCommerce product variations dropdown select on the shop page
<?php
// Display variations dropdowns on shop page for variable products
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' );
function woo_display_variation_dropdown_on_shop_page() {
global $product;
if( $product->is_type( 'variable' )) {