Skip to content

Instantly share code, notes, and snippets.

View Preciousomonze's full-sized avatar
🤡
Coding on the bicycle 😎🚴🏽‍♂️

Precious Omonzejele Preciousomonze

🤡
Coding on the bicycle 😎🚴🏽‍♂️
View GitHub Profile
@Preciousomonze
Preciousomonze / custom_checkout_file.php
Last active April 26, 2019 20:24
Custom phone validation on Woocommerce Checkout
<?php
/**
* For handling the extra fields displayed on checkout
*/
Class custom_checkout{
/**
* Construcdur :)
*/
public function __construct(){
@Preciousomonze
Preciousomonze / custom_file.php
Last active May 2, 2019 21:08
Pro Sites ThriveCart Gateway
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'PK_Prosites_Thrivecart_Gateway' ) ) {
class PK_Prosites_Thrivecart_Gateway {
/**
* ID of the gateway.
*
@Preciousomonze
Preciousomonze / class-wooss-webhook.php
Created July 10, 2019 11:34
Sendbox Shipping woocommerce plugin - Webhook dev
<?php
/**
* Webhook class to handle everything webhook
*
* Helps create the webhook url and also handling whatever is sent to the url :)
*
* @author Precious Omonze (Code Explorer) <https://github.com/Preciousomonze>
* License: GPLv2 or later
*/
@Preciousomonze
Preciousomonze / woo-create-product.php
Last active June 27, 2024 09:07
A snippet code for creating Products, use at your discretion
<?php
/**
* Creates a woocommerce product from a loystar product
*
* @param int $product_id(optional
* @param array $product_list(optional) | the loystar product list, this saves resources incase this function is called in the loop, the
* endpoint shouldn't be called everything
* @param bool $link_product(optional) | if set to true, the created woocommerce product will be linked to the loystar product
* @param bool $update(optional) | if set to true, it updates an existing product
* @param bool $only_import(optional) | if set to true, it updates only products that were imported from loystar direct.relevant when $update is true
@Preciousomonze
Preciousomonze / wc_pv_custom_filters.php
Last active October 25, 2023 11:15
Phone Validator Custom Filters and How to Use 📝
<?php
/**
* List of Phone Validator for WooCommerce custom Filters and how to use.
*
* Please feel free to add more to this, and don't forget to add your name to contributors, if you want to.
*
* @author Precious Omonzejele (CodeXplorer 🤾🏽‍♂️🥞🦜🤡)
* @contributors ...add name(s) here
*/
@Preciousomonze
Preciousomonze / _product_sorting_weird_fix.php
Last active September 18, 2020 00:26
Programmatically Remove other products when a particular product(s) is being added to cart, also add a force sell product(s) attached to it. More info here: https://woocommercecommunity.slack.com/archives/C1K9K3UD9/p1599861910188600
<?php
// This was added, cause the envrionment with WooCommerce and WooCommerce Subscription acted weird 🥴.
$pekky_callback_func_name = 'pekky_2_remove_cart_item_before_add_to_cart';
add_filter( 'woocommerce_add_to_cart_validation', $pekky_callback_func_name, 20, 3 );
// Works, different method, faster 😎
function pekky_2_remove_cart_item_before_add_to_cart( $passed, $product_id, $quantity ) {
// Sample values: array( 23,45,43 );
$stand_alone_products = [660];//array( 25221, 29237 ); //stand alone products
@Preciousomonze
Preciousomonze / meta.php
Last active October 5, 2020 21:03
Solve displaying of zipped file content on single-product page, more info here: https://woocommercecommunity.slack.com/archives/C1KAZ91E3/p1600320336188100
<?php
/*
* This code should be in the proper place of your_child_theme/woocommerce/single-product/meta.php file.
* Hope this helps you, but still, enjoy at your own risk. :)
*/
/**
* Single Product Meta
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/meta.php.
@Preciousomonze
Preciousomonze / pekky-wc-stand-alone-force-sells-sorting.php
Last active November 9, 2020 23:50
WooCommerce Cart Stand-alone and Force Sells Custom Sorting - This MU-Plugin helps sort Predefined Products to behave a certain way when they're added or removed from the cart page. Requires WooCommerce to Work.
<?php
/**
* WooCommerce Cart Stand-alone and Force Sells Custom Sorting.
*
* @package pekky-wc-stand-alone-force-sells-sorting
* @author Precious Omonzejele (CodeXplorer 🤾🏽‍♂️🥞🦜🤡)
*
* @wordpress-plugin
* Plugin Name: WooCommerce Cart Stand-alone and Force Sells Custom Sorting
* Plugin URI: https://gist.github.com/Preciousomonze/f41ebbd43b751d00e86fa4207e88413f
@Preciousomonze
Preciousomonze / README.md
Last active September 29, 2020 03:23
"if you've got a dump file for lost and abandoned snippets it can go there" @helgatheviking Said. I think it makes sense, so it's what i'll do 🤾🏽‍♂️

THIS Is the README Section

For proper documentation.

Format

  • DD/MM/YYYY - Repo Name/Issue branch - PR NAME - {File_location}: {Brief Note}

19/09/2020 - Woocommerce-free-gift-coupons/issues/33-force-gift-selection - #34 - {woocommerce-free-gift-coupons/assets/js/free-gift-coupons-meta-box.js}

The Js validation wasn't needed 🙂💔

06/03/2020 - woocommerce-name-your-price/fix-opc-script-validation-compatibility - #114 - {woocommerce-name-your-price/assets/js/name-your-price.js}

@Preciousomonze
Preciousomonze / pekky-wc-stand-alone-cart-sorting.php
Last active September 23, 2020 14:22
This MU-Plugin helps sort Predefined Products to behave a certain way when they're added to the cart. Requires WooCommerce to work. Use at your risk, enjoy! I mean, what's life without taking risks? 🚀
<?php
/**
* WooCommerce Cart Stand-alone Custom Sorting.
*
* @package pekky-wc-stand-alone-force-sells-sorting
* @author Precious Omonzejele (CodeXplorer 🤾🏽‍♂️🥞🦜🤡)
*
* @wordpress-plugin
* Plugin Name: WooCommerce Cart Stand-alone Custom Sorting
* Plugin URI: https://gist.github.com/Preciousomonze/f41ebbd43b751d00e86fa4207e88413f