Last active
November 17, 2021 13:57
-
-
Save somewherewarm-snippets/954c3c4a468aa8b20a5578288da0a39e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: WooCommerce Composite Products | |
* Plugin URI: https://woocommerce.com/products/composite-products/ | |
* Description: Use this snippet to add a permalink to the selected component option's product page | |
* Version: 1.0 | |
* Author: WooCommerce | |
* Author URI: https://woocommerce.com/ | |
* Developer: Manos Psychogyiopoulos | |
* | |
* Requires at least: 3.8 | |
* Tested up to: 5.3 | |
* | |
* Copyright: © 2021 Automattic. | |
* License: GNU General Public License v3.0 | |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html | |
*/ | |
add_action( 'woocommerce_composited_product_details', 'sw_cp_display_selected_product_permalink', 10, 3 ); | |
function sw_cp_display_selected_product_permalink( $product, $component_id, $composite_product ) { | |
echo '<a href="'. $product->get_permalink() . '">View Product</a>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment