Skip to content

Instantly share code, notes, and snippets.

View JarrydLong's full-sized avatar

Jarryd Long JarrydLong

  • Paid Memberships Pro
  • South Africa
  • 12:58 (UTC +02:00)
  • X @jarrydlong
View GitHub Profile
@ideadude
ideadude / tighten_pmpro_spam_protections.php
Created March 28, 2023 20:16
Tighten the PMPro Spam Protection so users/IPs with failed payments are locked out more quickly.
<?php
// Add these 2 lines to your wp-config.php
// This will lock IPs that fail checkout 5 times within 30 minutes.
// The default is 10 failures every 15 minutes (900 seconds).
define( 'PMPRO_SPAM_ACTION_NUM_LIMIT', 5 );
define( 'PMPRO_SPAM_ACTION_TIME_LIMIT', 1800 ); // in seconds
@kreamweb
kreamweb / functions.php
Created March 6, 2020 08:56
**YITH WooCommerce Point of Sale** - Snippet to change the max number of products for search
<?php
add_filter( 'woocommerce_rest_product_object_query', 'yith_pos_extend_post_per_pages', 5, 2 );
function yith_pos_extend_post_per_pages( $args, $request ){
if ( isset( $_GET[ 'queryName' ] ) && 'yith_pos_search' === $_GET[ 'queryName' ] ) {
$args[ 'posts_per_page' ] = 20;
}
return $args;
@kreamweb
kreamweb / functions.php
Last active September 13, 2024 07:44
** YITH Point of Sale for WooCommerce** How add the Sku inside search results
<?php
add_filter( 'woocommerce_rest_prepare_product_object', 'yith_pos_custom_product_response', 20, 3 );
function yith_pos_custom_product_response( $response, $object, $request ) {
$param = $request->get_param( 'queryName' );
if ( $param == 'yith_pos_search' ) {
$result = $response->data;
$result['name'] .= empty($result['sku']) ? '' : ' - ' . $result['sku'];
$response->data = $result;
<?php if ( ! function_exists( 'yith_pos_customization_order_status_to_complete' ) ) {
add_filter( 'woocommerce_payment_complete_order_status', 'yith_pos_customization_order_status_to_complete', 10, 3 );
function yith_pos_customization_order_status_to_complete( $status, $order_id, $order ) {
if ( absint( $order->get_meta( '_yith_pos_order' ) ) ) {
$status = 'completed';
}
return $status;
}