Admin Settings in all CPTs are already set. Continue to frontend.

This commit is contained in:
dwindown
2025-10-13 15:20:14 +07:00
parent 6f6b039441
commit 0446eb1064
11 changed files with 1610 additions and 884 deletions

View File

@@ -249,10 +249,25 @@ function formipay_get_currency_data_by_value($value, $data='') {
}
function formipay_get_post_meta($post_id, $metakey) {
function formipay_get_post_meta($post_id, $metakey = '') {
$value = get_post_meta($post_id, $metakey, true);
if($metakey == '') {
$flattened_meta = array();
foreach ($value as $key => $values) {
if (count($values) === 1) {
$flattened_meta[$key] = maybe_unserialize($values[0]);
} else {
// Keep multiple values as array (or handle as needed)
$flattened_meta[$key] = array_map('maybe_unserialize', $values);
}
}
return $flattened_meta;
}
if(!empty($value) && false !== $value && '' !== $value){
return $value;
}
@@ -951,4 +966,18 @@ function formipay_thankyoupage_allowed_html() {
'td' => [],
'br' => []
];
}
function formipay_is_donation($post_id) {
return boolval(formipay_get_post_meta($post_id, 'donation_active'));
}
function formipay_product_has_variation($product_id) {
$has_variation = formipay_get_post_meta($product_id, 'product_has_variation');
if( $has_variation == 'on' ){
return true;
}
return false;
}