<?php

/**
 * Render checkout embed
 *
 * @param  string $block_content block content
 * @param  array  $block         block
 * @return string
 */
function render_checkout_embed($block_content = '', $block = array())
{
  if (isset($block['blockName']) && 'checkoutpage/embed' === $block['blockName']) {
    load_cp_script();
  }

  return $block_content;
}

add_filter('render_block', 'render_checkout_embed', 10, 2);
