Skip to content

Instantly share code, notes, and snippets.

Avatar

Rashed Ripon rashedripon

View GitHub Profile
View plugin-test.php
<?php
/*
Plugin Name: wpdevguides.com must use plugins
Description: code that is used always
Version: 1.0.0
Author: WP Developer Guides
Author URI: wpdevguides.com
*/
add_filter( 'wc_stripe_payment_request_total_label_suffix', '__return_null' );
@rashedripon
rashedripon / rating.php
Created Mar 3, 2021
Show "Be the first to review" when no reviews are available
View rating.php
<?php
/**
* Single Product Rating
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/rating.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@rashedripon
rashedripon / functions.php
Last active Mar 1, 2021
Set custom order status for backorder items
View functions.php
// ---------------------
// 1. Register Order Status
add_filter( 'woocommerce_register_shop_order_post_statuses', 'extended_register_custom_order_status' );
function extended_register_custom_order_status( $order_statuses ){
// Status must start with "wc-"
$order_statuses['wc-custom-status'] = array(
'label' => _x( 'Custom Status', 'Order status', 'woocommerce' ),
@rashedripon
rashedripon / simple.php
Created Feb 14, 2021
Adding disabled Add to cart button for out of stock products
View simple.php
<?php
/**
* Simple product add to cart
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/add-to-cart/simple.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@rashedripon
rashedripon / details.php
Last active Nov 20, 2020
Dokan - Hide customer details from vendor dashboard when order status is on-hold
View details.php
<?php
global $woocommerce, $wpdb;
$order_id = isset( $_GET['order_id'] ) ? intval( $_GET['order_id'] ) : 0;
if ( !dokan_is_seller_has_order( dokan_get_current_user_id(), $order_id ) ) {
echo '<div class="dokan-alert dokan-alert-danger">' . esc_html__( 'This is not yours, I swear!', 'dokan-lite' ) . '</div>';
return;
}
View LogsController.php
<?php
namespace WeDevs\DokanPro\REST;
use WP_REST_Server;
use WeDevs\Dokan\Abstracts\DokanRESTAdminController;
class LogsController extends DokanRESTAdminController {
/**
@rashedripon
rashedripon / store.php
Created Jul 15, 2020
Hide products when Dokan store is closed by adding store open checker in store.php file
View store.php
<?php
/**
* The Template for displaying all single posts.
*
* @package dokan
* @package dokan - 2014 1.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@rashedripon
rashedripon / functions.php
Last active Jul 1, 2020
Add store open/close notice on Dokan vendor's order page
View functions.php
add_action('dokan_order_content_inside_before', function() {
$seller_id = dokan_get_current_user_id();
var_dump($seller_id);
global $wp;
$current_url = home_url();
$store_settings_page = $current_url . "/dashboard/settings/store";
@rashedripon
rashedripon / functions.php
Last active Sep 18, 2021
Dokan store open-close in single product page
View functions.php
<?php
//Remove the <?php while using it in your theme's functions.php file
//Add store open-show information before single product add-to-cart button
add_action('woocommerce_before_add_to_cart_form', 'dokan_open_close', 1000);
function dokan_open_close() {
global $product;
@rashedripon
rashedripon / functions.php
Created Dec 29, 2019
Remove "Become a vendor" button from customers account
View functions.php
<?php
// Remove "Become a vendor" button from customers account
if(class_exists('Dokan_Pro')) {
remove_action( 'woocommerce_after_my_account', array( Dokan_Pro::init(), 'dokan_account_migration_button' ) );
}