Skip to content

Instantly share code, notes, and snippets.

View tharlab's full-sized avatar
💭
I may be slow to respond.

Hary AK tharlab

💭
I may be slow to respond.
  • TharLab
  • east java
View GitHub Profile
@tharlab
tharlab / woo-template-parts-filter.php
Created February 27, 2024 01:31 — forked from Bobz-zg/woo-template-parts-filter.php
Quickly unhook WooCommerce template parts
<?php
/**
* Remove variouse template parts in WooCommerce
*/
add_filter( 'wc_get_template', function( $located, $template_name, $args, $template_path, $default_path ) {
$remove = [
'sale-flash.php',
'meta.php',
@tharlab
tharlab / functions.php
Created February 22, 2024 02:50 — forked from hivepress/functions.php
Add description to the details field in the payout request form #hivepress #marketplace
<?php
add_filter(
'hivepress/v1/forms/payout_request',
function( $form ) {
$form['fields']['details']['description'] = 'custom text here';
return $form;
},
1000
);
@tharlab
tharlab / functions.php
Created February 22, 2024 02:50 — forked from hivepress/functions.php
Add description to the note field in the order delivery form #hivepress #marketplace
<?php
add_filter(
'hivepress/v1/forms/order_deliver',
function( $form ) {
$form['fields']['note']['description'] = 'custom text here';
return $form;
},
1000
);
@tharlab
tharlab / mycred-woo-payout-on-completed
Created February 10, 2024 23:07 — forked from mycred/mycred-woo-payout-on-completed
By default myCRED will payout points for WooCommerce orders when an order has been marked as "paid". This means that no points will be paid out if a users pays using a manual gateway such as Check or Bank Transfers. This code snippet will force myCRED to payout when an order has been marked as "Completed" instead of paid.
/**
* Adjust myCRED Point Rewards
* Will move the points payout from when an order is "paid" to when
* an order is "completed".
* @version 1.0
*/
add_action( 'after_setup_theme', 'mycred_pro_adjust_woo_rewards', 110 );
function mycred_pro_adjust_woo_rewards() {
remove_action( 'woocommerce_payment_complete', 'mycred_woo_payout_rewards' );

STEP 1

Create the folder e.g. "/c/www/tests/php-fast-route/" on your machine.

cd /c/www/tests/php-fast-route/
composer init
composer require nikic/fast-route

@tharlab
tharlab / functions.php
Last active December 21, 2023 10:19 — forked from hivepress/functions.php
Enable rich text (HTML) editor for the listing description #hivepress #listings
<?php
add_filter(
'hivepress/v1/models/listing',
function( $model ) {
$model['fields']['description']['editor'] = array( //'quicktags' => true,
'media_buttons' => false, //if false show image button instead
'toolbar1' => 'styleselect, bold, italic, underline, bullist, numlist, blockquote, link, image, wp_adv, quicklink, fullscreen,',
);
return $model;
@tharlab
tharlab / WFACP_ReCaptcha_For_WC
Created December 21, 2023 06:04 — forked from xlplugins/WFACP_ReCaptcha_For_WC
Funnelkit Checkout comptability added with ReCaptcha For WC by Thirteen Web Solution
class WFACP_ReCaptcha_For_WC {
private $instance = null;
public function __construct() {
add_action( 'wfacp_template_load', [ $this, 'actions' ] );
}
public function is_enable() {
return class_exists( 'I13_Woo_Recpatcha' );
}
@tharlab
tharlab / checkout-functions.php
Created December 21, 2023 05:58 — forked from doubleedesign/checkout-functions.php
Add reCaptcha v2 to WooCommerce Checkout
<?php
/**
* Add reCaptcha to checkout form
* Note: Can't place within the payment part of the form, WooCommerce just won't show it, choose an appropriate action to add it to accordingly
* @param $checkout
*/
function doublee_show_me_the_checkout_captcha($checkout) {
echo '<div class="g-recaptcha" data-sitekey="YOUR_KEY_HERE"></div>';
}
add_action('woocommerce_checkout_order_review', 'doublee_show_me_the_checkout_captcha', 18);
@tharlab
tharlab / functions.php
Created December 14, 2023 02:37 — forked from hivepress/functions.php
Limit the maximum number of listings per user account #hivepress #listings
<?php
add_filter(
'hivepress/v1/forms/listing_submit/errors',
function( $errors, $form ) {
$listing = $form->get_model();
if ( $listing && $listing->get_user__id() ) {
$listing_count = \HivePress\Models\Listing::query()->filter(
[
'status__in' => [ 'publish', 'pending', 'draft' ],